Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: PHP Array?
10-22-2012, 11:58 PM #1
- Join Date
- Jun 2009
- Thanked 0 Times in 0 Posts
I am trying to combine several variables into one PHP array (I think)
Basically the user keys in the date and time into 6 boxes:
YYYY MM DD HH MM SS
I am then trying to combine those fields into one array.
Whatever I'm doing is not working and I'd really appreciate some help.
$start_time = $start_year,$start_month,$start_date,$start_hour,$start_minute,$start_seconds;
10-23-2012, 12:11 AM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,668 Times in 2,637 Posts
Looks to me that you mean a string, not an array.
To convert that to an array, you'd simply wrap it in
array(). So that would be
array($start_year, . . ., $start_seconds);.
What you want is a string. I'd recommend a sprintf as its simple.
$start_time = sprintf('%d %d %d %d %d %d', $start_year, $start_month, $start_date, $start_hour, $start_minute, $start_seconds);
<input type="text" name="inputDate[year]" /> <input type="text" name="inputDate[month]" /> ...
Last edited by Fou-Lu; 10-23-2012 at 12:17 AM.
Users who have thanked Fou-Lu for this post: