EvilZone

Programming and Scripting => Web Oriented Coding => : Code.Illusionist July 08, 2013, 04:13:09 PM

: [PHP] Array
: Code.Illusionist July 08, 2013, 04:13:09 PM
Hello again. Today I have problem to break string and take those peaces into array. For example I have this string: 7!3!9!05!2401!64!05!11!64!4!343!2!11!9!04 .
Now, I'd like to take all the numbers separated by sign ! . So my new array contain:
7 , 3, 9, 05, 2401 , 64, 05, 11, 64, 5, 343, 2 ,11, 9, 04 .
How can I do such a thing?
: Re: [PHP] Array
: ca0s July 08, 2013, 04:21:15 PM
: (php)
<?php
$s 
"7!3!9!05!2401!64!05!11!64!4!343!2!11!9!04";
$a explode("!"$s);
print_r($a);
?>

:
http://php.net/manual/es/function.explode.php
: Re: [PHP] Array
: erc August 22, 2013, 11:17:19 PM
:
<?php


$str 
"7!3!9!05!2401!64!05!11!64!4!343!2!11!9!04";
$newstr explode('!',$str);
for(
$i 0$i count($newstr ); $i++) 
{
echo $d[$i] . "&emsp;";
}


?>