Alternate Control Syntaxes

Author Topic: Alternate Control Syntaxes  (Read 622 times)

Offline chinmay.sahooTopic starter

  • Trade Count: (0)
  • Full Member
  • ***
  • Thank You 2
  • Posts: 159
  • Karma: 0
    • Hot Shaper
Alternate Control Syntaxes
« on: 12-15-2015, 04:15:06 »
PHP offers another way to start and end the bodies of the if, switch, for, and while constructs. It amounts to replacing the initial brace of the enclosed block with a colon and the closing brace with a special ending statement for that construct (endif, endswitch, endfor, and endwhile). For example, the if syntax becomes

Quote
if (expression):
statement1
statement2
..
endif;

Or:

Quote
if (expression):
statement1
statement2
..
elseif (expression2):
statement3
..
else:
statement4
..
endif;


 

Related Topics

  Subject / Started by Replies Last post
0 Replies
1565 Views
Last post 11-24-2010, 12:36:03
by thosecars82
4 Replies
1752 Views
Last post 01-19-2012, 22:54:39
by cpaoutsourcing
0 Replies
1383 Views
Last post 03-22-2012, 02:00:19
by vishalhost
2 Replies
1389 Views
Last post 11-14-2012, 08:09:49
by dave-o99
0 Replies
588 Views
Last post 01-30-2017, 03:09:44
by beingchinmay