I am passing this array from one function to another function componentBuildRoute(&$query) { $segments = array(); $segments[] = $var... ... $str = serialize($segments); $str = urlencode($str); $segments[] = $str; //if I do a pre print_r for $segments[]; //THIS PRINTS //**SERIALIZED: //Array //( // [page] => mostrar_clasificado // [catid] => 3 // [category_alias] => nuevo // [adid] => 3 // [ad_alias] => 3-way-conector-de-tubos // [0] => a%3A5%3A%7Bs%3A4%3A%22page%22%3Bs%3A19%3A%22mostrar_clasificado%22%3Bs%3A5%3A%22catid%22%3Bs%3A1%3A%223%22%3Bs%3A14%3A%22category_alias%22%3Bs%3A5%3A%22nuevo%22%3Bs%3A4%3A%22adid%22%3Bs%3A1%3A%223%22%3Bs%3A8%3A%22ad_alias%22%3Bs%3A23%3A%223-way-conector-de-tubos%22%3B%7D //)** return $segments; }
function componentParseRoute( $segments ) { //if I do a pre print_r() for the passed array of $segments[]; //*THIS PRINTS //**PASSED SEGMENTS: //Array //( // [0] => mostrar_clasificado // [1] => 3 // [2] => nuevo // [3] => 3 // [4] => 3:way-conector-de-tubos // [5] => a:5-{s-4-"page";s-19-"mostrar_clasificado";s-5-"catid";s-1-"3";s-14-"category_alias";s-5-"nuevo";s-4-"adid";s-1-"3";s-8-"ad_alias";s-23-"3-way-conector-de-tubos";} //)** $str = end($segments); echo "LAST ELEMENT OF PASSED ARRAY STR: ".**$str**; //THIS PRINTS: //LAST ELEMENT OF PASSED ARRAY STR: a:5-{s-4-"page";s-19-"mostrar_clasificado";s-5-"catid";s-1-"3";s-14-"category_alias";s-5-"nuevo";s-4-"adid";s-1-"3";s-8-"ad_alias";s-23-"3-way-conector-de-tubos";} //**DECODED ALREADY HOW COME?** $testing = array(); **$testing = unserialize($str);** echo "UNSERIALIZED TESTING:"; print_r($testing); //THIS PRINTS: //UNSERIALIZED SEGMENTS: //**NO ARRAY!!! (BLANK SPACE AFTER TEXT) NO UNSERIALIZED ARRAY** //I'LL PRINT THE ARRAY AGAIN TO VERIFY I GOT WHAT I THOUGHT I GOT echo "SEGMENTS 2:"; print_r($segments); //THIS PRINTS: //SEGMENTS 2: // //Array //( // [0] => mostrar_clasificado // [1] => 3 // [2] => nuevo // [3] => 3 // [4] => 3:way-conector-de-tubos // [5] => a:5-{s-4-"page";s-19-"mostrar_clasificado";s-5-"catid";s-1-"3";s-14-"category_alias";s-5-"nuevo";s-4-"adid";s-1-"3";s-8-"ad_alias";s-23-"3-way-conector-de-tubos";} //) //I AM UNABLE TO **UNSERIALIZED** THE LAST ELEMENT OF THE ARRAY //any pointers? //also, as I mentioned before, //I don't understand why the urlencoded //and serialized //element of the array, gets passed to //the second function already urldecoded