Re: Arrays

From: Date: Sat, 04 Feb 2006 20:50:37 +0000
Subject: Re: Arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-229881@lists.php.net to get a copy of this message
At 11:12 AM 2/4/2006, Philip W. wrote:
When using the following string format, I get an error from PHP. $text['text'] = "String Text" ;
Hi Philip, If that's literally a line from your script, my guess is that "text" is a reserved word and can't be used as a variable name. Try $sText or $sSomethingMeaningful. In this and future postings, it would help us help you if you share all relevant details such as the exact error message you see. I've gotten into the habit of prefixing all my variable names with their type: $aSomething - array $sSomething - string $iSomething - integer $nSomething - numeric $bSomething - Boolean In a language like PHP in which data typing is so loose, I find that prefixing the variable type a) helps me keep variables straight and b) prevents me from inadvertantly using reserved words as variable names. Great resource: http://php.net/ You can quickly look up details from the reference guide by entering key words after the domain name, for example:
        http://php.net/array
gets you a page of array functions. Have fun, Paul

« previous php.general (#229881) next »