Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts

    store characters in array

    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);

  • #2
    New Coder
    Join Date
    Sep 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    str_split();

    PHP Code:
    <?php

    $chars 
    'a12&n ul9800\n24';

    $array str_split $chars );

    print_r $array );

    ?>

  • #3
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Thanks!
    And do you know maybe function to sort those chars in string maybe
    $string = "acbd";
    $sorted ="abcd";


  • #4
    Regular Coder
    Join Date
    Oct 2005
    Location
    Right Here
    Posts
    654
    Thanks
    1
    Thanked 0 Times in 0 Posts
    http://www.php.net and then do a search for array sort. You will be amazed at the results.

  • #5
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by iLLin View Post
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •