Need little PHP help



  • Hi all!

    I`ve created new file (modified iface_status) that shows PPPoE uptime only…

    Here it is:

    require_once("/usr/local/www/guiconfig.inc");
    ?>
            $i = 0;
            $ifdescrs = get_configured_interface_with_descr(false, true);
            foreach ($ifdescrs as $ifdescr => $ifname):
            $ifinfo = get_interface_info($ifdescr);
    ?>
    
                    echo $ifinfo['ppp_uptime'];
            ?>
    
    

    Can someone please help me create this without foreach loop please?
    Also, now value is like 111:05:51 (H:M:S), how can I convert this to D:H:M:S like 4 days, 15 hours, 5 minutes, 51 seconds

    Thanks all!



  • Hi, Best regards

    I try to understand your code,

    in this lines

    foreach ($ifdescrs as $ifdescr => $ifname):
            $ifinfo = get_interface_info($ifdescr);

    i think that maybe you have one error, because you don't use the real value ( $ifname), you use, the  key ($ifdescr)

            foreach ($ifdescrs as $ifdescr => $ifname):
            $ifinfo = get_interface_info($ifname);
    ...


Log in to reply