fert Posted November 26, 2006 Share Posted November 26, 2006 [code]$code=explode("\n",$_POST[code]);$num=count($code);for($count=0;$count<$num;$count++){ $code[$count]=str_replace("%","",$code[$count]); $temp=explode("=",$code); $vars[$temp[0]]=$temp[1];}print_r($vars);[/code]This code is suppose to extract a letter and a value from a string that looks like this "%a=5", but the array is empty and i can't figure out why. When i use this code:[code]$code="%a=5";$code=str_replace("%","",$code);$temp=explode("=",$code);$vars[$temp[0]]=$temp[1];print_r($vars);[/code]I get [quote]Array ( [a] => 5 )[/quote][/code] Link to comment https://forums.phpfreaks.com/topic/28476-why-doesnt-this-code-work/ Share on other sites More sharing options...
fert Posted November 26, 2006 Author Share Posted November 26, 2006 nevermind i fixed it Link to comment https://forums.phpfreaks.com/topic/28476-why-doesnt-this-code-work/#findComment-130302 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.