note 24509 added to function.substr

From: Date: Tue, 20 Aug 2002 01:24:35 +0000
Subject: note 24509 added to function.substr
Groups: php.notes 
Request: Send a blank email to php-notes+get-35230@lists.php.net to get a copy of this message
here some code, with it you can tile some text and e.g. different color in the first, the last and the mid characters. I made some for IRC and my client-colors. don't know, for what you use it, i place it on my site. i think, it's a good effect. <? $text = "1234567890"; $text_len = strlen($text); $var1 = substr($text,0,1); // returns 1 $var2 = substr($text,$text_len-1,$text_len); // returns 0 $var3 = substr($text,1,$text_len-2); // returns 23456789 echo "first char:$var1 last char: $var2 rest: $var3"; ?> -- http://www.php.net/manual/en/function.substr.php http://master.php.net/manage/user-notes.php?action=edit+24509 http://master.php.net/manage/user-notes.php?action=delete+24509 http://master.php.net/manage/user-notes.php?action=reject+24509

« previous php.notes (#35230) next »