Skip to content

Alternative syntax for PHP control structures | HEAVYWORKS

Link To Full Story: www.heavyworks.net

The alternative syntax consists in changing the opening brace ({) to a colon (:) and each closing brace to its respective closing function: endif;, endfor;, endforeach;, endwhile; and endswitch;.

Closing functions list

opens if ([parameters]):
closes endif;
opens for ([parameters]):
closes endfor;
opens foreach ([parameters]):
closes endforeach;
opens while ([parameters]):
closes endwhile;
opens switch ([value]):
closes endswitch;

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*