Annulé

need help with a small function

I need help getting the following function to work:

private function timeSlots($date,$startTime, $endTime)

{

$startTime = '07:00'

$endTime = '20:30';

$numberWorkableHours = 13;

//build array of times.

$times = array();

$time = $startTime;

$times[$startTime] = $time;

for($i = 1;$i < $numberWorkableHours ;$i++) {

$time = strtotime("+ 1 Hour",$time);

$key = $time;

$times[$key] = date("g:i a",$time);

}

echo '<pre>';

print_r($times);

echo '<pre>';

}

I am looking to have an array of times incremented by one hour each so the aray would go from: 7:00 am to 8:00 PM but I cannot get it to work and a little help would be appreciated.

Compétences : Conception graphique , HTML, PHP, Design de site internet

Voir plus : get help design, echo design, small little, need help website design, php help function, function time, small function php, cylogic, need help php, build time key, small little website, array function php, private key php, need help website, help need job, help need artist design

Concernant l'employeur :
( 103 commentaires ) Bountiful, United States

N° du projet : #2407564

12 freelance ont fait une offre moyenne de 30 $ pour ce travail

gopalvora

ready to start Thanks

30 $ USD en 1 jour
(345 Commentaires)
7.8
ALSOFT10

Please check Pm.

30 $ USD en 0 jours
(74 Commentaires)
6.7
sat12

Please see PMB

30 $ USD en 1 jour
(196 Commentaires)
6.2
charlie2002

I did it for you before bidding. It's just ready now. I can send a demo if needed. Lets finish the contract within minutes.

30 $ USD en 1 jour
(23 Commentaires)
5.3
bcsaba

Think can do this for you.

30 $ USD en 0 jours
(33 Commentaires)
4.7
ajreal

here it goes : $slots = range(7,20); foreach ($slots as $hour) { echo date("g:i a", strtotime("$hour:00:00")).PHP_EOL; } all the other changes is make the function more flexible, can accept variable hours Plus

30 $ USD en 1 jour
(23 Commentaires)
4.4
wnwsolutions

Hello Ready to help...

30 $ USD en 1 jour
(8 Commentaires)
4.0
avj1989

Can help you half done. Please check PM.

30 $ USD en 1 jour
(8 Commentaires)
3.1
mrnewit

Hi, please check PM!

30 $ USD en 0 jours
(2 Commentaires)
2.9
duchuyctlk

Hi, very easy problem. Some syntax wrong and function is not called. Please let me help you.

30 $ USD en 1 jour
(6 Commentaires)
2.4
ryankirgan

The code you've posted was really close and required only modest tweaking. I've modified and believe I have this working. As such, code can be provided instantly. Current key is the Unix-timestamp, but script is ea Plus

30 $ USD en 1 jour
(1 Commentaire)
1.0
syncromindproj

I can help you with this and we can start right now.

30 $ USD en 0 jours
(0 Commentaires)
0.0
Misunderstood

<?php print "time is expressed in the number of seconds since " . date("M d, Y h:i:s",0) . "\n"; // using an integer key where the integer is the hour of the day for($i = 7;$i < 20 ;$i++) { $times[$i] = mktime($i Plus

30 $ USD en 0 jours
(0 Commentaires)
0.0