...

View Full Version : store characters in array



matak
05-29-2007, 11:48 PM
what pattern i need to use to get every single character from string like this

$chars = "a12&n ul9800\n24";

into array

array([0]=>a[1]=>1[2]=>2[3]=>&[4]=>n[5]=>[6]u ... [11]=>\[12]=>n[13]=>2[14]=>4);

printf
05-30-2007, 12:00 AM
str_split();


<?php

$chars = 'a12&n ul9800\n24';

$array = str_split ( $chars );

print_r ( $array );

?>

matak
05-30-2007, 12:18 AM
Thanks!
And do you know maybe function to sort those chars in string maybe
$string = "acbd";
$sorted ="abcd";

:)

iLLin
05-30-2007, 12:23 AM
http://www.php.net and then do a search for array sort. You will be amazed at the results.

matak
05-30-2007, 12:31 AM
http://www.php.net and then do a search for array sort. You will be amazed at the results.

i know of array sort, wondering about string sort :), any other PHP compatible language, like C will do to



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum