baiwan Posted March 30, 2007 Share Posted March 30, 2007 I have created a simple function to load an array with name / value pairs, and return the array. Most of the time it works as expected, but one particular name / value pair causes the function not to return. No errors are reported. My system details: OS: Windows XP SP2 ("Windows NT OFFICE 5.1 build 2600" reported by phpinfo) Server: XAMPP for windows (apache) PHP Version: PHP Version 5.1.4 The function: function get_jsparams($qs){ $qs=str_replace('%20',' ',$qs); $parts=explode('{',$qs,20); foreach ($parts as $v) { $vname=substr($v,0,3); $vval=trim(substr($v,4),'}'); echo $vname.' - '; echo '"'.$vval.'"<br />'; if($vval){ $parray[$vname]=$vval;} } echo '<pre>'; print_r($parray); echo '</pre>'; return $parray; } The calling code: $jsparams=get_jsparams($_SERVER['QUERY_STRING']); echo '<pre>'; print_r($jsparams); echo '</pre>'; The Query string: {Cvr;1v01}{Sit;oAxb1rhJ5432}{Lod;load}{Wth;1280}{Hth;1024} The function should add name / value pairs to the array and return the array. In this example the first name / value pair should be name=Cvr, value=1v01. The key value here appears to be the "Lod;load" name/value pair. Change either "Lod" or "load" and the function works as expected! This has me mystified! With these values the function fails to return, i.e., the code following the function call is not executed. ??? Any help would be much appreciated! Link to comment https://forums.phpfreaks.com/topic/44915-solved-function-doesnt-return-if-load-is-an-array-value/ Share on other sites More sharing options...
neel_basu Posted March 30, 2007 Share Posted March 30, 2007 Is this Block in Function Printing the array ?? echo '<pre>'; print_r($parray); echo '</pre>'; Link to comment https://forums.phpfreaks.com/topic/44915-solved-function-doesnt-return-if-load-is-an-array-value/#findComment-218119 Share on other sites More sharing options...
baiwan Posted March 30, 2007 Author Share Posted March 30, 2007 Yes, the print_r in the function correctly prints the array. No code after the function return is executed. Link to comment https://forums.phpfreaks.com/topic/44915-solved-function-doesnt-return-if-load-is-an-array-value/#findComment-218123 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.