why is there different syntax same outcome?

Posted by Lizard on Stack Overflow See other posts from Stack Overflow or by Lizard
Published on 2010-06-11T11:18:50Z Indexed on 2010/06/11 11:22 UTC
Read the original article Hit count: 155

Filed under:
|
|
|

Why is there different syntax same outcome?

For example

# Example 1
if($myCondition == true) :
    #my code here
endif;

if($myCondition == true) {
    #my code here
}


# Example 2
foreach($films as $film) : 
    #my code here
endforeach;

foreach($films as $film) { 
    #my code here
}

Also I have been using <?= for ages now and i now understand that is deprecated and I should be using <?php echo Is this the case and why? Its alot more annoying to have to write that out each time.

What are your thoughts?

© Stack Overflow or respective owner

Related posts about php

Related posts about syntax