I was looking on the net for a simple ini class for php and came across this one code.google.com
I can not really understand what might be going on. The code is in the function iniParser and this is the line of code.
if($this->_iniParsedArray = parse_ini_file( $filename, true ))
My first impression is the usual "IF" comparison check then I noticed a single equals sign and not the double equals sign (==) thus making the line of code now an assignment ie passing one variable into another.
Now I am confused as if it was just an assignment then why the IF statement, surly it would be
($this->_iniParsedArray = parse_ini_file( $filename, true ))
This code means:-
If the return value of parse_ini_file( $filename, true )
is not false
- then everything is OK
, return TRUE
.
If the parse_ini_file returns false, so does $this->_iniParsedArray
=> the function will return FALSE
.
That is valid usage I believe. parse_ini_file()
returns false on failure, so if false is returned, the code inside that if condition will not be processed. It would look like
if (false)
if failure occurs.