Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/4368-printing-from-an-array/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.