Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] Nie działa funkcja
Bobek1910
post 22.04.2009, 10:36:47
Post #1





Grupa: Zarejestrowani
Postów: 31
Pomógł: 3
Dołączył: 14.04.2009
Skąd: Wziąć piwo?

Ostrzeżenie: (0%)
-----


Witam!

Napisałem oto taką funkcję:

CODE
function counttime()

{

global $time;



$arrHour = explode(":", $time);

$arrTime2 = array(8, 10, 12, 14, 16, 18, 20, 22, 24);

foreach ($arrTime2 as $intTime)

{

if ($arrHour[0] < $intTime)

{

$intWait = (($intTime - $arrHour[0]) * 60) - $arrHour[1];

$intHours = floor($intWait / 60);

$intMinutes = $intWait % 60;

break;

}

}

$arrTime = array('', '');

if ($intHours < 1)

{

$arrTime[0] = '';

}

if ($intHours == 1)

{

$arrTime[0] = $intHours.echo 'godzina';

}

if ($intHours > 1 && $intHours < 5)

{

$arrTime[0] = $intHours.echo 'godziny';

}

if ($intHours > 4)

{

$arrTime[0] = $intHours.echo 'godzin';

}

if ($intMinutes < 1)

{

$arrTime[1] = '';

}

if ($intMinutes == 1)

{

$arrTime[1] = $intMinutes.echo 'minuta';

}

if (($intMinutes > 1 && $intMinutes < 5) || ereg("^[2-5][2-4]*$", $intMinutes))

{

$arrTime[1] = $intMinutes.echo 'minuty';

}

if (($intMinutes > 4 && $intMinutes < 20) || ereg("^[2-5][5-9]*$", $intMinutes) || ereg("^[2-5][0-1]*$", $intMinutes))

{

$arrTime[1] = $intMinutes.echo 'minut';

}



return $arrTime;

}


i ten skrypt nie dość, że nie chce działać, to przerywa działanie innych skryptów po załadowaniu tego...

Proszę o pomoc

Bobek
Go to the top of the page
+Quote Post
porady-it.pl
post 22.04.2009, 10:57:23
Post #2





Grupa: Zarejestrowani
Postów: 89
Pomógł: 20
Dołączył: 13.05.2007
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Takie zapisy są niepoprawne winksmiley.jpg

  1. <?php
  2. $arrTime[0] = $intHours.echo 'godzina';
  3. ?>


Chodziło Ci chyba o:

  1. <?php
  2. $arrTime[0] = $intHours.'godzina';
  3. ?>


--------------------
Kurs Video PHP i MySQL, porady-it.pl - gotowe rozwiązania dla webmasterów
Go to the top of the page
+Quote Post
Bobek1910
post 22.04.2009, 17:17:07
Post #3





Grupa: Zarejestrowani
Postów: 31
Pomógł: 3
Dołączył: 14.04.2009
Skąd: Wziąć piwo?

Ostrzeżenie: (0%)
-----


Dzięki wielkie działa smile.gif
Aż wstyd się przyznać do takiego błędu... sad.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 31.07.2025 - 07:50