Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-05-2006, 11:27 AM   PM User | #1
zeeshan
New to the CF scene

 
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
zeeshan is an unknown quantity at this point
PHP configuration problem?? foreach not behaving

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.

PHP Code:
$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
zeeshan is offline   Reply With Quote
Old 01-05-2006, 03:16 PM   PM User | #2
bcarl314
Mega-ultimate member


 
Join Date: Jun 2002
Location: Winona, MN - The land of 10,000 lakes
Posts: 1,855
Thanks: 1
Thanked 45 Times in 42 Posts
bcarl314 will become famous soon enough
Seems odd.

Is there a difference between

PHP Code:
print_r($FilenameParameters1); 
On localhost and the server?
bcarl314 is offline   Reply With Quote
Old 01-05-2006, 05:10 PM   PM User | #3
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,901
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
there are no configuration issues that affect the operation of foreach() , I can only assume that the code you posted in only part of the code ?, have you tried your example (just that and nothing else) on the linux box ?
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 01-06-2006, 10:06 AM   PM User | #4
zeeshan
New to the CF scene

 
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
zeeshan is an unknown quantity at this point
hey,

actually this is not the first time i have faced this problem. It always happens when i upload any code from my windows server to fedora server. I always end up changing all occurances of foreach to suit the fedora server.

and yes bcarl the print_r works same on both. It prints the contents of an array on both servers...


Thanks
zeeshan is offline   Reply With Quote
Old 01-06-2006, 10:41 AM   PM User | #5
Velox Letum
Senior Coder

 
Join Date: Apr 2005
Location: Colorado, United States
Posts: 1,208
Thanks: 0
Thanked 0 Times in 0 Posts
Velox Letum is an unknown quantity at this point
Perhaps the copy of PHP on your server was compiled improperly. Try the latest binary or recompile from the source.
__________________
"$question = ( to() ) ? be() : ~be();"
Velox Letum is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:02 PM.


Advertisement
Log in to turn off these ads.