SORRY FOR ANY MISTAKE IN WRITING, I AM STILL LEARNING ENGLISH
I have a string which will be added from the user
I will separate the string into an array I'll separate each character alone
then I want to find a specific word which is
if(
this is my code but I got an error
$StingFromTheUser = 'public class a
{
if(int i=0; i<10; i++)
{
//any thing
}
} '//end of the string
I separate it using this code which is correct
$arr = str_split($StringFromTheUser);
Now I want to find if the code has if statement or not so I'm going to search for the word
if(
here is my code
for($i=0; $i<count($arr)-2; $i++)
{
if(arr[$i]=='i' && arr[$i+1]=='f' && arr[$i+2]=='(')
{
echo $arr[$i].$arr[$i+1].$arr[$i+2];
}
}
but unfortunately I got this error
Parse error: syntax error, unexpected '[' in /fileName.php on line 331
Aucun commentaire:
Enregistrer un commentaire