SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php conditional statement

    Is their anyway possible to end your conditional statement in php inside. Like ending it without reading all the code inside:

    for example:

    if (condition statement)
    {
    code 1
    code 2
    code 3
    if (code 4 is empty)
    {
    END CONDITION HERE
    }
    code 5
    code 6
    code 7
    }

    something like this.. What I want is if code 4 is empty or whatever condition, it should end. The code 5, code 6, code 7 should not be read. I'm wondering if php have that.

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,234
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    if (condition statement)
    {
    code 1
    code 2
    code 3
    if (code 4 is empty)
    {
    END CONDITION HERE
    }
    else
    {
    code 5
    code 6
    code 7
    }
    }

  3. #3
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,053
    Mentioned
    66 Post(s)
    Tagged
    0 Thread(s)
    No else, just use not.

    Code php:
    if ($condition) {
    /*
     * code
     */
      if (!$condition2) {
      /*
       * More code
       */
      }
    }

  4. #4
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,234
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    Dope! I misread it the first time around thinking "END CONDITION HERE" would contain code, good catch.


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
  •