Re: Arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux