my problem is, the serialize hash format is like this
$str = "list_container[0][id]=1&list_container[1][id]=2 &list_container[1][children][0][id]=3 &list_container[1][children][0][children][0][id]=4 &list_container[1][children][0][children][1][id]=5";at first I'm thinking to use explode function to split a string by using ampersand '&' and = as a delimiter and variable variables to get a variable but I think it's not so effective. Then I ask uncle google what others people do to solve this problem.Yeah, I like google... one of the search result is by using parse_str. It's so easy and this is what I want.
How to use parse_str?.
$str = "list_container[0][id]=1&list_container[1][id]=2 &list_container[1][children][0][id]=3 &list_container[1][children][0][children][0][id]=4 &list_container[1][children][0][children][1][id]=5"; parse_str($str); //Now parse_str function will return string value as an array set. //I can get the value by using $list_container as a variable var_dump($list_container);You can download sample file :How to use parse_str in form post
0 comments:
Post a Comment