note 77031 deleted from function.str-split by crell

From: Date: Wed, 29 Jun 2022 18:28:00 +0000
Subject: note 77031 deleted from function.str-split by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218676@lists.php.net to get a copy of this message
Note Submitter: kjensen at iaff106 dot com ---- Here is what I use. I started with examples here but modified to my own version: <?php if (phpversion () < "5"){ // define PHP5 functions if server uses PHP4 function str_split($text, $split = 1) { if (!is_string($text)) return false; if (!is_numeric($split) && $split < 1) return false; $len = strlen($text); $array = array(); $s = 0; $e=$split; while ($s <$len) { $e=($e <$len)?$e:$len; $array[] = substr($text, $s,$e); $s = $s+$e; } return $array; } } ?>

« previous php.notes (#218676) next »