Connecting Tech Pros Worldwide Forums | Help | Site Map

Same script, but work in some server and doesn't work in some server.

Newbie
 
Join Date: Nov 2007
Posts: 15
#1: Jun 24 '08
[PHP]<?php

$range = split(',', '2008-11-1>2008-11-30=123,2008-12-1>2008-12-31=222,');
for ($y=0; $y<(count($range)-1); $y++){
$equalto = explode('=',$range[$y]);
$splitagain = split('>',$equalto[0]);
for ($s=strtotime($splitagain[0]); $s<(strtotime($splitagain[1])+10); $s=$s+(60*60*24))
{
$money[$s]=$equalto[1];

}

}

$kk = $money[1225497600]; //1225497600 is the time stamp within the for loop
if ($kk==''){echo 'what happen??';}
else {echo $kk;}
?>[/PHP]


it is the server it works http://kamchihau.meibu.com/testcalender.php

however in this server it goes. http://www.yagit.com.hk/testcalender.php
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,938
#2: Jun 24 '08

re: Same script, but work in some server and doesn't work in some server.


split() should be used with regular expressions.

Quote:
split

(PHP 4, PHP 5)

split — Split string into array by regular expression
hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#3: Jun 24 '08

re: Same script, but work in some server and doesn't work in some server.


Use explode instead.
Newbie
 
Join Date: Nov 2007
Posts: 15
#4: Jun 24 '08

re: Same script, but work in some server and doesn't work in some server.


I know the reason............ Time Zone.............. i guess i have to rewrite the program.......... thankssssss...
Reply