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! 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 Good luck: http://us3.php.net/manual/en/control-structures.foreach.php http://us1.php.net/echo 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 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 Link to comment https://forums.phpfreaks.com/topic/282998-foreach-array-help/#findComment-1454048 Share on other sites More sharing options...
AbraCadaver Posted October 15, 2013 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); 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!! Link to comment https://forums.phpfreaks.com/topic/282998-foreach-array-help/#findComment-1454054 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.