Page 1 of 1

using an array to create vars.

Posted: Fri Jun 04, 2004 3:42 pm
by pinehead18
I have a date information stored in a sql database. That looks like this 01/18/2004

I want to use an array to pull that date and seperate those 01 18 2004 into their own variables. Seperated by the / what array function do i use to do this?

Thank you for your tyime and help,.
Anthony

Posted: Fri Jun 04, 2004 4:54 pm
by feyd

Code: Select all

$array = explode('/', $date);

Posted: Fri Jun 04, 2004 9:52 pm
by evilmonkey
Just of curiousity, what would that function return? Would it be something like

Code: Select all

$array[1] = 01;
$array[2] = 18;
$array[3] = 2004;
??

Thanks!

Posted: Fri Jun 04, 2004 10:30 pm
by d3ad1ysp0rk
Yes, except minus one from each number.

Arrays start at 0, not 1, so it'd have values in $array[0], [1], and [2].

Posted: Sat Jun 05, 2004 1:15 pm
by evilmonkey
Oh, okay, got it. :) Thanks.