Jump to content


Photo

Printing from an array


  • Please log in to reply
No replies to this topic

#1 k4pil

k4pil
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 07 March 2006 - 09:36 PM

Hi there ppl!

Just a quickie...

I want to output from an array. I am currently doing the below;


$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

It works fine. But is there a more efficient way of doing the same thing bacause it seems a lil long winded.

Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users