ruby-rails
answered Aug 10 '21 00:00
need to put ; (semicolon) to end the at every PHP statement
echo "Hello world";
this simple code which print Hello world but main point is here that it end with semi colon (;)
but all statements don't end with; semicolon
check below code where for and if used, we don't need to put the condition if or else or switch statement or looping like for or while or foreach need to end with a semicolon
foreach($data as $value){
if(false){
echo "false";
}
}
for ($i = 1; $i <= 10; $i++) {
echo $i;
}
the following control operators are not ended with semicolon
if
else
elseif / else if
for
foreach
while
do-while
switch
goto
each above have its own way of using it.