note 25302 deleted from function.explode by kennyt

From: Date: Sat, 28 Feb 2004 20:33:58 +0000
Subject: note 25302 deleted from function.explode by kennyt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-65956@lists.php.net to get a copy of this message
Note Submitter: xdatjv_2002@yahoo.co.uk ---- here is an example of removing multiple spaces and exploding. This comes in handy when you want to split strings by occurances of space(s). $tmplink = "sometext aftermultiplespace aftersinglespace aftertwospaces"; //convert multiple spaces to single space $tmplink = preg_replace("/( +)/", " ", $tmplink); $tmplink = explode(" ", $tmplink); print_r($tmplink); The output looks like:- Array ( [0] => sometext [1] => aftermultiplespace [2] => aftersinglespace [3] => aftertwospaces )

« previous php.notes (#65956) next »