PHP Return/result error

Discussion in 'PHP' started by Warez Dominator, Nov 16, 2011.

  1. #1
    Hello,

    Can any one correct my PHP code

    Support i have 3 Ips such as
    192.168.1.1 << Main IP
    192.168.1.2-----------------
    -- << Extra Ips
    192.168.1.3-----------------

    function alistips( $params )
    {
        $params = array( "login", "password", "servername");
        $ret = get( "listofsubips", $params );
        if ( $ret )
        {
            if ( !is_array( $ret ) || empty( $ret ) )
            {
                exit( "Nothing to display." );
            }
            else
            {
                foreach ( $ret as $ip )
                {
                    $result = $ip;
                    
                }
    return $result;
            }
        }
        else
        {
            $result = "There is some error";
        }
    }
    PHP:
    In the above code out put comes as 192.168.1.3

    function alistips( $params )
    {
        $params = array( "login", "password", "servername");
        $ret = get( "listofsubips", $params );
        if ( $ret )
        {
            if ( !is_array( $ret ) || empty( $ret ) )
            {
                exit( "Nothing to display." );
            }
            else
            {
                foreach ( $ret as $ip )
                {
                    $result = $ip;
                    return $result;
                }
            }
        }
        else
        {
            $result = "There is some error";
        }
    }
    PHP:
    If using above code the output comes as 192.168.1.2

    and now my question is that what changes need in the above code that the out will be
    192.168.1.1
    192.168.1.2
    192.168.1.3

    That is all the Ips that we have in the server


    Waiting for answer

    Regards
     
    Warez Dominator, Nov 16, 2011 IP
  2. Warez Dominator

    Warez Dominator Member

    Messages:
    80
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #2
    Hello,

    The problem with the coading has been resolved.

    Regards
     
    Warez Dominator, Nov 16, 2011 IP