不使用php自带反转函数,将字符串反转。
//不用自带函数将其反转方法一$str = this is php;$strarr = explode(' ',$str);$count = count($strarr)-1;for($i=$count;$i>=0;$i--){ $revstr .= $strarr[$i].' ';}echo $revstr;方法二$str = this is php;$strarr = explode(' ',$str);krsort($strarr);$res = implode($strarr,' ');echo $res;
2. 获取客户端和服务端ip地址
客户端 方法一: echo $_server['remote_addr']; 方法二: getenv('remote_addr');服务端 方法一: echo $_server['server_addr']; 方法二:getenv('server_addr');