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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts

    split a string into array

    Hi;
    i am trying to split a string into array by regular expression, but it could not work, could anyone help
    , please.


    my work as following, but it does not work.
    i want to break the string into two part, one is "this is the test 1", and another one is "this is testing 2 </object> this is test 3";
    $string = "this is the test 1 <object width=\"425\" height=\"355\"> this is testing 2 </object> this is test 3";

    $str=split("<object(.?)>",$string);
    echo $str[0];
    echo "<br>";
    echo $str[1];
    Last edited by kamkam; 02-29-2008 at 10:02 PM.

  • #2
    New Coder
    Join Date
    Aug 2007
    Posts
    14
    Thanks
    3
    Thanked 1 Time in 1 Post
    I think preg_split should do what you want.
    "entia non sunt multiplicanda praeter necessitatem" - "Entities should not be multiplied beyond necessity" Occam's Razor

  • #3
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts
    Thanks a lot.


  •  

    Posting Permissions

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