note 84775 added to function.substr

From: Date: Tue, 29 Jul 2008 18:18:41 +0000
Subject: note 84775 added to function.substr
Groups: php.notes 
Request: Send a blank email to php-notes+get-142904@lists.php.net to get a copy of this message
I wrote this simple function $input = "hello world" echo(limitchrmid($imput,10)) // hel ... rld //limit chars middle function limitchrmid($value,$lenght){ if (strlen($value) >= $lenght ){ $lenght_max = ($lenght/2)-3; $start = strlen($value)- $lenght_max; $limited = substr($value,0,$lenght_max); $limited.= " ... "; $limited.= substr($value,$start,$lenght_max); } else{ $limited = $value; } return $limited; } ---- Server IP: 213.250.2.28 Probable Submitter: 213.229.210.211 ---- Manual Page -- http://www.php.net/manual/en/function.substr.php Edit -- https://master.php.net/note/edit/84775 Del: integrated -- https://master.php.net/note/delete/84775/integrated Del: useless -- https://master.php.net/note/delete/84775/useless Del: bad code -- https://master.php.net/note/delete/84775/bad+code Del: spam -- https://master.php.net/note/delete/84775/spam Del: non-english -- https://master.php.net/note/delete/84775/non-english Del: in docs -- https://master.php.net/note/delete/84775/in+docs Del: other reasons-- https://master.php.net/note/delete/84775 Reject -- https://master.php.net/note/reject/84775 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#142904) next »