Why do class functions in php not need semicolons at the end? -
for example...
public function processrowset($rowset, $singlerow = false){ $resultarray = array(); while($row = mysql_fetch_assoc($rowset)){ array_push($resultarray, $row); }; if ($singlerow === true){ return $resultarray[0]; }; return $resultarray; } ...and next line continues without issue
when first starting oop php, made error of putting semicolon @ end , took me hour figure out wrong.
thanks help!
the difference between statements , expressions:
- if-statements, while-statements, functions, , on statements not need semicolon-terminated.
- actual commands expressions (i.e
$foo = bar()
). standalone expressions require semicolons, since don't have braces signify expression ends.
php borrows syntax c.
Comments
Post a Comment