php how can set counter limit?

Discussion in 'PHP & Perl' started by livorno87, Dec 8, 2015.

  1. livorno87

    livorno87 Newbie

    Joined:
    Jan 6, 2015
    Messages:
    19
    Likes Received:
    2
     
  2. roadhamster

    roadhamster Regular Member

    Joined:
    Mar 12, 2012
    Messages:
    356
    Likes Received:
    252
    Code:
    $result = $request->getResponseText();
                    if ( is_string($result) )
                    {
                        $result = json_decode($result);
                        if ( is_object($result) )
                        {
                            if ($result->status == 'ok') $this->_result++;
                            [COLOR=#ff0000]if ($this->_result > 11) exit();[/COLOR]
                
                }
                    }
    
    Maybe the code in red would do the trick.
     
    • Thanks Thanks x 1
  3. bartosimpsonio

    bartosimpsonio Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 21, 2013
    Messages:
    13,685
    Likes Received:
    12,299
    Occupation:
    MACHIN LURNIN
    Location:
    TUVALU
    Home Page:
    This works but it'll exit the script and everything that comes after it. If you want to continue doing something else below, just use break instead of exit()

    if ($this->_result > 11) break;
     
  4. ChanzGrande

    ChanzGrande Elite Member

    Joined:
    Feb 16, 2008
    Messages:
    2,485
    Likes Received:
    1,185
    Occupation:
    Accountant
    Location:
    Northern Woods Counting Money
    Wish there was some code commenting here. lol. Looks like you are coding a great application or working with a decently coded one for accomplishing a like of what? Clearly looks like a fb or youtube oriented script. Way to go.
     
  5. livorno87

    livorno87 Newbie

    Joined:
    Jan 6, 2015
    Messages:
    19
    Likes Received:
    2
    not solve my problem. anybody php coder can help me on teamviewer? my skype: alejandro23244