Thursday, 30 August 2018
Subscribe to:
Post Comments (Atom)
foreach
loop with an if statement inside it so that if $value
equals 'Messages'
it should increment my variable num1
by 1
, but the if statement doesn't appear to be working correctly. Any help would be greatly appreciated.$value
, it will echo out the value of every section in the array. <?php
$num1 = 0;
foreach($inventory['Category'] as $key => $value) {
if ($value == 'Messages') {
$num1++;
}
}
?>
$num1
is not increasing could be because $value
is not 'Messages'. Try echoing $value
variable & see.Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment