note 40920 added to function.explode

From: Date: Fri, 19 Mar 2004 04:55:49 +0000
Subject: note 40920 added to function.explode
Groups: php.notes 
Request: Send a blank email to php-notes+get-67045@lists.php.net to get a copy of this message
Since this doesn't work: $string = 'Something'; $chars = explode('',$string); If you just need to do some simple operations on every character of a string (one at a time) try this: $string = 'Something'; for($i=0;$i<strlen($string);++$i){ echo $string{$i}; //add your command here } I should have figured that out long ago, but I didn't, so I thought I'd share for those of us who have thick skulls with certain aspects of PHP. ---- Manual Page -- http://www.php.net/manual/en/function.explode.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40920 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40920&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40920&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67045) next »