split - PHP: Text explode() problem -
i have problem explode() function. use function explode strings "name: replica" in string has 2 or more colons ( ":" ) , there problem because script is: example: "name: replica:replica2:replica3"
$explode = explode(":", $string); $query = "insert `table` (`field_1`, `field_2`) values ('".$explode[0]."', '".$explode[1]."')";
and need solution problem. because when split string after first colon ( ":" ) second part must last part.
regards, george!
p.s. - sorry english.
i think want use 'limit' (third) argument explode()
:
list($attribute, $value) = explode(":", $string, 2);
that make sure 2 results.
Comments
Post a Comment