this answer maybe on google but i couldnt find it because i dont know the exact keywords for this. The situation is as follows. I have an array called $value that contains 2 types of arrays:
[12] => Array (
[id] => phone
[class] => phone
[config] => Array (
[disabled] => 1
[value] => 1
)
)
[46] => Array (
[id] => email
[class] => email
[config] => Array (
[display_type] => disabled
[value] => 1
)
)
As you may see, they are almost the same except for the fact that one contains an array called "disabled" and the other "display_type". What im trying to do is to count how many of each type i have. I tried with this:
foreach ( $value as $col ) {
if ( $col->config == 'disabled' ) {
$total_default++;
} elseif ( $col->config == 'display_type' ) {
$total_custom++;
}
}
but didnt work. I know it must be very simple but i just cant figure it out.
Thank you.
===, instead of==, or you might see some odd behaviour once in a while. PHP will evaluate'1e3' == '1000'to true, for instance. Just a good tip :)