Please explain this PHP syntax

I looked through the functions in the manual, but I still do not understand this. According to the person who wrote the code, if the user enters "y", then a function will be executed (not shown here). However, because of !it, it seems to me that a function (not shown here) will be executed if the user enters something other than "y".

Please explain (I am a relative newbie as detailed as possible).

if(!strncasecmp(trim(fgets(STDIN)),'y',1)) 
+3
source share
2 answers

fgets(STDIN) - reads a line from standard input (keyboard in your case).

trim - , . , ' y' 'y ', 'y'

strncasecmp - Y, Y, . 0, , ! ( ), 0 1, if.

:

if(strncasecmp(trim(fgets(STDIN)),'y',1) == 0) 
+10

strncasecmp 0, , !, , .

+4

All Articles