Jump to content

Archived

This topic is now archived and is closed to further replies.

k4pil

Printing from an array

Recommended Posts

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.