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 6 of 6
  1. #1
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts

    explode delimiter's

    is it possible to have no delimiter with an explode, for instance.

    PHP Code:
        $sid explode("""1234567");
        
            foreach(
    $sid AS $s){
            if(
    $s){
             echo 
    ''.$s.'<br>';
            } 
        } 
    and still have it return

    1
    2
    3
    4
    5
    6
    7

    thanks.

  • #2
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts
    Yes its verry possible
    Working towards a Internet where we don't have website just browser applications Kill the Hyper-link and say hello to 3D Games in the browser :)

  • #3
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    thanks for the help......

  • #4
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts

  • #5
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts
    Quote Originally Posted by kbluhm View Post
    Split is DEAD, GONE POOF, as of PHP6 you have to use explode,

    E_DEPRECATED error in php 5.3
    Working towards a Internet where we don't have website just browser applications Kill the Hyper-link and say hello to 3D Games in the browser :)

  • #6
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    Quote Originally Posted by barkermn01 View Post
    Split is DEAD, GONE POOF, as of PHP6 you have to use explode,

    E_DEPRECATED error in php 5.3
    Well, technically you are correct. And if I would have linked to split(), you would be a hero right now and I would look like a fool.

    Buuuuuuttttt... did you click the link? Did you read it properly?

    I didn't link to split(), I linked to str_split().

    In fact, if you try to explode() using an empty delimiter (as you suggested), well that's just plain not allowed... and you will get an empty delimiter WARNING. And if you had attempted to read the original question, the OP had already tried using explode() -- albeit unsuccessfully -- with an empty delimiter.

    There are only two ways to accomplish what was asked:
    PHP Code:
    str_split$string );        // faster
    preg_split'//'$string ); // slower 
    Last edited by kbluhm; 10-21-2009 at 05:59 PM.


  •  

    Posting Permissions

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