Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 19th, 2005, 08:57 AM
Authorized User
 
Join Date: Dec 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ababb
Default p83 the use of periods...

Re top of page: "We added a little trick to our normal echo statement: the use of periods to amend the statement as such:"

Do the periods act as concatenation operators here?

In the example:
echo "My top ". $_POST["num"]. " movies are:<br>";

It looks like 'my top' and 'movies are' are enclosed in quotes, and the $_POST, using the periods, is inserted between these clauses, if you will. So in this sense the periods appear to concatenate the clauses. Is that right?

By the way, notice there is a space after the first period before the $_POST... Is that space intentional or arbitrary?



__________________
ABabb
Dallas TX
 
Old January 19th, 2005, 09:37 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

That is correct, it is concatenation.

It can also be written as:
echo "My top {$_POST["num"]} movies are:<br>";

The curly braces act as delimiters for the variable, since a double-quoted string is used variable replacement happens. This is particularly useful with multidimensional arrays.

You can read more on this here:
http://www.php.net/manual/en/language.types.string.php

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
 
Old January 19th, 2005, 09:48 AM
Authorized User
 
Join Date: Dec 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ababb
Default

Thanks. And a very nice web site, the smiling souls site.






Similar Threads
Thread Thread Starter Forum Replies Last Post
solved - P5AMWD, Ch 2, p83, Ex. 1 - array help BarrettB Beginning PHP 0 August 13th, 2007 02:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.