SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: if else ladders

  1. #1
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    if else ladders

    Do If else ladder works in php also?

  2. #2
    SitePoint Mentor bronze trophy
    chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,040
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by selina1 View Post
    Do If else ladder works in php also?
    No it doesn't, in PHP you need to use semicolons and colons to open and close the IF ELSE statements. See the below example:

    PHP Code:
    if (=== true):
        echo 
    'True';
    else if (
    2):
        echo 
    'False';
    else if (
    'php' === 'PHP'):
        echo 
    'False';
    endif; 
    Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
    Having lame problems with your code? Let us help by using a jsFiddle

Bookmarks

Posting Permissions

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