note 38226 added to function.substr

From: Date: Fri, 12 Dec 2003 21:37:45 +0000
Subject: note 38226 added to function.substr
Groups: php.notes 
Request: Send a blank email to php-notes+get-61875@lists.php.net to get a copy of this message
A down and dirty function to grab an IP address. Works well on RedHat8. function ipaddress ($interface) { //function parses out the IP Address of the given $interface $ip_string = trim(exec ("ifconfig $interface | grep inet")); $ip_start = strpos($ip_string,"addr:")+5; $ip_length = (strpos($ip_string,"Bcast:")-2) - $ip_start; $ip_address = substr($ip_string,$ip_start,$ip_length); return $ip_address; } ---- Manual Page -- http://www.php.net/manual/en/function.substr.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38226 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38226&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38226&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#61875) next »