Explode(): Empty delimiter.?

i am trying to explode a series of ones and zeros into an array.

$string = ‘00000000000000’;
$ary = explode(‘’,$string);

and im getting this error WANRING explode(): Empty delimiter.

im sure that is because i am using ‘’ as my delimeter but im trying to explode every character into an array im pretty sure i did this before so im unsure why it wont work now.

any thoughts?

thanks.

php5: http://www.php.net/manual/en/function.str-split.php
php4:


$ary = preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY);

Or if you want to do it another way…


$s = '0000000000';
$a = array();

for ($i = 0, $l = strlen($s); $i < $l; $i++) {
	$a[] = $s{$i};
}

This should be much faster then preg_split…in theory…

$string = '00100000000000';
$i=0;
for ($i; $i < strlen($string); $i++) {
   echo $string[$i]. '<br />';
}

A string is already an array e.g.

$string = '00100000000000';
echo $string[2] // echos 1
Edit:

Actually not much different than logic_earths…

thanks guys

Or simply:

$string = '01000011000100';
$ary = str_split($string);

Regards,

Michaël

Great! News to me. Thanks!