note 51322 deleted from function.preg-split by betz

From: Date: Thu, 21 Apr 2005 10:49:44 +0000
Subject: note 51322 deleted from function.preg-split by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-88325@lists.php.net to get a copy of this message
Note Submitter: matt at hallam4life dot co dot uk ---- Here's a simple script i made. It uses preg_split, explode and some array_reverse functions to print, the defined text, backwards. I'm sure its not the easiest way to do this but it works: <?php $text = 'Hello, I am called Joe Bloggs'; $print1 = array_reverse(explode(' ', $text)); $count = count($print1); $i = 0; while ($i <= $count) { $chars = preg_split('//', $print1[$i], -1, PREG_SPLIT_NO_EMPTY); $print = array_reverse($chars); $count2 = count($print); $i++; $b = 0; while ($b <= $count2) { if ($b == $count2) { echo "\r\r"; } echo $print[$b]; $b++; } } ?> when run, page reads : "sggolB eoJ dellac ma I ,olleH"

« previous php.notes (#88325) next »