www.webdeveloper.com
Results 1 to 3 of 3

Thread: PHP Basic Notation..Probably?

  1. #1
    Join Date
    Sep 2008
    Posts
    260

    PHP Basic Notation..Probably?

    Hello..I'm coming from JavaScript and just learning PHP..

    I've never seen this kind of notation before:

    PHP Code:
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    ..where they use " : "...

    I'm thinking that this still reads, if have_post() is true (with the function specifics having an array of values that are probably returned), while there is an iteration of values returned, do function (the_post())...?

    If this is the case then, where does the ":" come in?...I didn't see this kind of notation in my PHP book...

    by the way...this is a line from the Wordpress platform...
    Last edited by ChuckB; 06-05-2010 at 12:36 PM.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,175
    Looks like they're using the alternate syntax for control structures. While there is nothing "wrong" with that, I'm not a big fan of it since the vast majority of PHP coders use the curly brace syntax, plus I generally frown upon merging multiple statements into one line both for readability and debugging reasons.
    Last edited by NogDog; 06-05-2010 at 12:42 PM.

  3. #3
    Join Date
    Sep 2008
    Posts
    260
    Quote Originally Posted by NogDog View Post
    Looks like they're using the alternate syntax for control structures. While there is nothing "wrong" with that, I'm not a big fan of it since the vast majority of PHP coders use the curly brace syntax, plus I generally frown upon merging multiple statements into one line both for readability and debugging reasons.
    alright..appreciate it...I figured it was just structured differently but read the same...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles