k4pil Posted March 7, 2006 Share Posted March 7, 2006 Hi there ppl!Just a quickie...I want to output from an array. I am currently doing the below;[code]$time=mysql_result($result2,$i,"time"); $page=mysql_result($result2,$i,"page"); //get the time and convert the string into an array $str = $time; $arr1 = str_split($str); echo "<b>Time:</b>"; echo $arr1[7];//day echo "$arr1[8]/";//day echo $arr1[5];//month echo "$arr1[6]/";//month echo $arr1[1];//year echo $arr1[2];//year echo $arr1[3];//year echo $arr1[4];//year echo " $arr1[9]";//time -h echo "$arr1[10]:";//time -h[/code]It works fine. But is there a more efficient way of doing the same thing bacause it seems a lil long winded.Thanks Quote Link to comment https://forums.phpfreaks.com/topic/4368-printing-from-an-array/ 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.