PHP configuration problem, foreach not behaving ???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zeeshan_kh
Forum Newbie
Posts: 2
Joined: Thu Jan 05, 2006 4:46 am

PHP configuration problem, foreach not behaving ???

Post by zeeshan_kh »

Hey,
I have got PHP 4.3.10 Installed on my local system (windows) and server (Fedora).

foreach loop runs perfectly on my local system but it gives me problems on the server.

here is a sample code.

Code: Select all

$FilenameParameters1 = array('ar', 'bg', 'bc', 'far'); 
foreach ($FilenameParameters1 as $key) { 
  echo $key; 
}
on local system it prints the values
"ar bg bc far"

but on the server it prints
"Array Array Array Array"

it works fine if i change $key to $k=>$key in the loop. Because of that i'm not able to run any libraries or classes downloaded from the internet.

please HELP me sort this out.

Thanks

User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

That's strange - what version of PHP is on the server?

Mac
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

from the post, I would guess 4.3.10 ... I think I've run into this problem before, but I don't recall how I fixed it.. basically, it comes down to the exact same settings/versions/blah between two installs of php on different servers can result in different results due to odd quirks that make x run slightly different than y.. it's extremely annoying, and can some times be fixed by literally moving the lines around, or resaving the file as a new file... it's just plain weird..
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

feyd wrote:from the post, I would guess 4.3.10 ...
Didn't read that very well oops...

If there is the possiblity then upgrading the versions to the latest may help in case there was a small bug fixed...

Mac
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Is there some php (binary) cache loaded on the fedora server? what i experienced with ioncube at a shiny day...
zeeshan_kh
Forum Newbie
Posts: 2
Joined: Thu Jan 05, 2006 4:46 am

Post by zeeshan_kh »

Thanks all you guyz for taking the time to reply. I spent an hour yesterday comparing the php.ini file from my windows server and the fedora server and they both look exactly the same...only change i suspected was this

Fedora server
variables_order = "EGPCS"

Local Server
variables_order = "GPCS"


but i dont think this effects the behavior of arrays or loops in any way. I could upgrade my server to the latest version of PHP but i'm just concerned how will that effect the existing sites running on it...


cheers!
Post Reply