The code in the PHPstrstr function book does not understand the code in the book about strstr. it is searched based on the submitted feedback and sent to unused emails.
$ Totaladress = 'destback @ example.com '; if (strstr ($ feedback, 'shop') {$ totaladress = 'retail @ example.com ';} else {$ totaladress = 'account @ example.com ';}
I have read the description on w3school. after strstr finds the target string, it returns the remaining part, that is, the string. Otherwise, it returns false. what is the meaning of the function return value directly used as the if judgment condition?
Thank you for your explanation.
Reply to discussion (solution)
The strstr () function searches for the first occurrence of a string in another string.
This function returns the rest of the string (from the matching point ). If the searched string is not found, false is returned.
Echo strstr ("Hello world! "," World ");
?>
Output:
World!
If is determined, it is converted into a boolean string = true in brackets.
You can understand it as a shorthand
$ A = strstr ($ feedback, 'shop ');
If ($! = False ){}
If is determined, it is converted into a boolean string = true in brackets.
You can understand it as a shorthand
$ A = strstr ($ feedback, 'shop ');
If ($! = False ){}
Thank you. after reading your answer, I went to the internet to check it again. I understand.