jaymc Posted November 13, 2008 Share Posted November 13, 2008 I use array_map on an array after doing that, using join() no longer works Im pretty sure its because the position of the array is at the end I tried to use reset() on the array but that did not work. Any ideas? Quote Link to comment Share on other sites More sharing options...
.josh Posted November 13, 2008 Share Posted November 13, 2008 internal pointer of the array should have no bearing on it. Post some code, and also a better description than "it no longer works." Quote Link to comment Share on other sites More sharing options...
jaymc Posted November 13, 2008 Author Share Posted November 13, 2008 $_POST = array_map("strip_tags", $_POST); $beans = join($_POST); join wont work on $_POST after array_map Note: reset($_POST); did not work Quote Link to comment Share on other sites More sharing options...
.josh Posted November 13, 2008 Share Posted November 13, 2008 so what do you mean by "won't work?" Other than the fact that you didn't supply the glue so it defaults to '' it should work just fine. This works fine on my server: <?php if ($_POST) { $_POST = array_map("strip_tags", $_POST); print_r($_POST); $beans = join($_POST); echo "<br/>$beans"; } ?> <br/><br/> <form action = '' method = 'post'> <input type = 'text' name = 'a'><br/> <input type = 'text' name = 'c'><br/> <input type = 'text' name = 'd'><br/> <input type = 'submit' value = 'submit'> </form> I get an array of values echoed out with html tags stripped, and then a string of array values with no spaces. Quote Link to comment Share on other sites More sharing options...
jaymc Posted November 14, 2008 Author Share Posted November 14, 2008 Ok I see the problem. Without array_map("strip_tags", $_POST); everything is fine and this is the print_r of $POST Array ( [x] => 2 [y] => 3 [list] => Array ( [0] => 23913081 [1] => 23912398 ) ) With array_map("strip_tags", $_POST); here is the print_r of $_POST Array ( [x] => 2 [y] => 3 [list] => Array ) The issue is secondary arrays within a primary array Quote Link to comment Share on other sites More sharing options...
.josh Posted November 14, 2008 Share Posted November 14, 2008 http://us3.php.net/manual/en/function.array-map.php#70710 Quote Link to comment Share on other sites More sharing options...
jaymc Posted November 15, 2008 Author Share Posted November 15, 2008 Cheers 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.