homepage Welcome to WebmasterWorld Guest from 54.235.61.62
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Declaring arrays
sometimes errors, sometimes not
ryan_b83




msg:3539640
 4:55 pm on Jan 3, 2008 (gmt 0)

Hello, I am wondering why the exact same code, one running on 2 different enviornments gives me 2 totally different results.

Windows IIS PHP 4.7...
and one running on
Linux Apache PHP 4.2...

ON WINDOWS:
$someArray[1][1] = "ABC";
echo $someArray[1][1];

RETURNS:
A

ON LINUX:
$someArray[1][1] = "ABC";
echo $someArray[1][1];

RETURNS:
ABC

I then realized that if i declare $someArray[1] = array(), it then works on the Windows version. This is ok except i have a whole bunch of code that works on the Linux enviornment and not the Windows, is there a way to change a setting in the PHP configuration to not force me to have to declare the variables as arrays before attemping to use them?

thanks,
Ryan

 

coopster




msg:3539686
 5:34 pm on Jan 3, 2008 (gmt 0)

Doesn't make sense, really. I wonder if that echo in the Windows version is printing the letter "A" from the first word in "Array" or something? Change the value from "ABC" to "XYZ", make sure you are running the exact same little snippet shown here on both servers and see what your output is.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved