donatastommy Posted October 15, 2013 Share Posted October 15, 2013 so i have an rray something like this Array ( [0] => hii [1] => thereee); i want to go through a loop and add a "--" before each of them to print it out, so it would print out --hii--thereee THANK YOU! Quote Link to comment https://forums.phpfreaks.com/topic/282998-foreach-array-help/ Share on other sites More sharing options...
AbraCadaver Posted October 15, 2013 Share Posted October 15, 2013 (edited) Good luck: http://us3.php.net/manual/en/control-structures.foreach.php http://us1.php.net/echo Edited October 15, 2013 by AbraCadaver Quote Link to comment https://forums.phpfreaks.com/topic/282998-foreach-array-help/#findComment-1454047 Share on other sites More sharing options...
donatastommy Posted October 15, 2013 Author Share Posted October 15, 2013 (edited) Good luck: http://us3.php.net/manual/en/control-structures.foreach.php http://us1.php.net/echo ok thanks foreach($array as $key=>$value) (echo("\x"."$value")) So here is my array Array ( [0] => 41); instead of printing a capital A, it just print \x41.. x41 is the hex representation of A Edited October 15, 2013 by donatastommy Quote Link to comment https://forums.phpfreaks.com/topic/282998-foreach-array-help/#findComment-1454048 Share on other sites More sharing options...
Solution AbraCadaver Posted October 15, 2013 Solution Share Posted October 15, 2013 (edited) WOW! Not sure what you want to do, but that changed gears faster than I've ever seen. From, how to foreach() and add -- all the way to, how to print a character using its hex value! echo hex2bin($value); Edited October 15, 2013 by AbraCadaver Quote Link to comment https://forums.phpfreaks.com/topic/282998-foreach-array-help/#findComment-1454053 Share on other sites More sharing options...
donatastommy Posted October 15, 2013 Author Share Posted October 15, 2013 WOW! Not sure what you want to do, but that changed gears faster than I've ever seen. From, how to foreach() and add -- all the way to, how to print a character using its hex value! echo hex2bin($value); Haha true! Thanks so much!! Quote Link to comment https://forums.phpfreaks.com/topic/282998-foreach-array-help/#findComment-1454054 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.