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 2 of 2
  1. #1
    New Coder
    Join Date
    May 2006
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HELP string search & separate

    Hi all guys,

    I have a $recordset that have the value "string(string2)".

    How can i separate the string and string2 to $string and $string2?

    Thanks

  • #2
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    <pre><?php

    $str 
    "string(string2)";

    function 
    str_extract($str) {
        
    preg_match("/(\w+)\((\w+)\)/"$str$matches);
        return(array(
    $matches[1] => ''$matches[2] => ''));
    }

    extract(str_extract($str));
    var_dump($string);
    var_dump($string2);
    /* result
    string(0) ""
    string(0) ""

     */

    ?>
    why do you want something that would simply initialize variables?
    Last edited by fci; 06-15-2006 at 02:42 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
    •