note 47227 deleted from function.substr by aidan

From: Date: Mon, 08 Nov 2004 04:17:04 +0000
Subject: note 47227 deleted from function.substr by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-80261@lists.php.net to get a copy of this message
Note Submitter: jakub dot belescak at nevidiz dot com ---- Here is a function you may find handy. You input an string (for example 15986) and and a number (3) and it divides it from end by this number. Outputs (15 986) function Triplets($input, $by){ $output = substr($input, 0, strlen($input)%$by); for ($i = 0; $i < floor(strlen($input)/$by); $i++ ){ $output.= " ".substr($input, $i*$by+strlen($input)%$by,$by); } return $output; } ---- Reason: useless note

« previous php.notes (#80261) next »