Here is a code example that I want to execute in php
For ($i=0; $i<count($array); $i++)
{
If($array[$i]=="a")
{
// call a php function
}
elseif($array[$i]=="b")
{
// call a php function
}
elseif($array[$i]=="c")
{
// call a php function
}
.
.
.
.
.
And so on...
Else
Echo 'Default';
}
As soon as the first IF condition is satisfied and the function is executed.. The loop doesn't increment and the php code after this for loop also doesn't execute..
I can't seem to understand why
The same happens if I implement switch case or while statement.. Also I've tried adding break and continue to the end of each if .. But it doesn't make any difference.
Edit: there was small error in the variable part.. But that is the not main issue here.. There are no syntax errors in my code.. Maybe there's some problem with the logic..
You have syntax error in For ($i=0; $i<count($array); i++)
correct is For ($i=0; $i<count($array); $i++)
this code worked and have output