How is this possible?

This is the code I have …





echo "Count: " . count($this->fk_id_with_custom_field_ids) . "<br />";

echo "Print R: "; print_r($this->fk_id_with_custom_field_ids); echo "<br />";

echo "Echo: "; echo($this->fk_id_with_custom_field_ids); echo "<br />";

echo "Isset: " . isset($this->fk_id_with_custom_field_ids);




This is the result I get …

Count: 1

Print R:

Echo:

Isset: 1

How can it have a count of 1 and isset 1 unyet nothing shows in print_r and echo?

What is fk_id_with_custom_field_ids? And where’s this code?

Its in my model, fk_id_with_custom_field_ids is suppose to be an array.

But its not really an array in this example as print_r would show it as one.

I am just trying to understand how the above example is possible?

count($this->fk_id_with_custome_field_ids) will return 1 if the arg is not an array or a countable.

Since print_r(…) returns nothing you don’t have an array but some other type.

echo($var); Try echo $var;? Not sure on this.

isset() is returning true because your variable has some other value in it.

do var_dump($this->fk_id_with_custome_field_ids) to see what’s inside.