To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 01 December 2004 19:29, Matthew Sims wrote:

> 
> So when using arrays with string keys within strings you need to
> concatenate it. 
> 
> $var = "I live in the city of ". $_POST['cityname'];

No, you do not *need* to -- it is one option, certainly, but there is no
necessity about it.

Within double-quoted strings, it is perfectly acceptable to use unquoted
array keys:

    $var = "I live in the city of $_POST[cityname]";

If you prefer to quote your keys, or have more complex expressions within
the brackets, there is also the {} syntax:

    $var = "I live in the city of {$_POST['cityname']}";

    $field = 'city';
    $var = "I live in the $field of {$_POST[$field.'name']}";

Anyway, read up on it.
http://uk.php.net/manual/en/language.types.string.php#language.types.string.
parsing

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to