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] Quote Link to comment Share on other sites More sharing options...
fert Posted November 26, 2006 Author Share Posted November 26, 2006 nevermind i fixed it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.