note 70797 deleted from function.str-split by crell

From: Date: Wed, 29 Jun 2022 18:33:52 +0000
Subject: note 70797 deleted from function.str-split by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218695@lists.php.net to get a copy of this message
Note Submitter: webmaster at nsssa dot ca ---- I noticed in the post below me that his function would return an array with an empty key at the end. So here is just a little fix for it. <?php //Create a string split function for pre PHP5 versions function str_split($str, $nr) { //Return an array with 1 less item then the one we have return array_slice(split("-l-", chunk_split($str, $nr, '-l-')), 0, -1); } ?>

« previous php.notes (#218695) next »