anarchoi Posted March 5, 2008 Share Posted March 5, 2008 here is my code: $xi = $ix + 1; $one = array("2002", "12012", "13013", "17017"); $two = array("one", "two", "three", "four"); $realnames = str_replace($one, $two, $realnumbers); $realnumbers2 = $ix + 1; $realnumbers = $realnumbers2 * 1000 + $realnumbers2; echo "$realnames \n"; echo "<br>( $realnumbers )"; } else { // echo "Option $ix was NOT selected<br />\n"; // } } the replacements works, but the last entry isn't displayed (17017/four in this code) i.e. $realnumbers = 2002 12012 13013 17017 only the three first will be displayed/replaced as soon as i use str_replace with $realnumbers :/ ...weird Quote Link to comment Share on other sites More sharing options...
anarchoi Posted March 5, 2008 Author Share Posted March 5, 2008 bump Quote Link to comment Share on other sites More sharing options...
bpops Posted March 5, 2008 Share Posted March 5, 2008 Is this inside another loop or something? On your fourth line, $realnames = str_replace($one, $two, $realnumbers); You're using $realnumbers but its not yet defined. Quote Link to comment Share on other sites More sharing options...
anarchoi Posted March 5, 2008 Author Share Posted March 5, 2008 yeah, i forgot to add the beginning of the script it's comming from $ix ... i am doing *1000 +$ix just so the numbers always look differents and its easier for the replacement (or else if i replace a 2 it would replace 222, 202, 12222, etc) $nbr = 21; $selected = $post[field7]; for($ix = 0; $ix < $nbr; $ix++) { if(pow(2, $ix) & $selected) { 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.