p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: Question again.


Message #1 by "Josh" <jeb_braun@i...> on Wed, 15 May 2002 07:43:28
I found this article "PHP Guidelines" and what it said in some parts is 
different than what Beginning PHP4 says. For example
In the book for assigning varibles to do like this
$name = "Bill"
and in the article to do like this
$name = 'Bill'

Just wondering if some of the things in the article are the right way to 
do it because the book is a couple years old and PHP might have changed or 
something. Here is the address of the article 
http://www.evolt.org/article/PHP_Guidelines/17/26440/index.html

Just what to know so if the article is right then I would like to start 
doing stuff the right way before I get used to the wrong way. Thanks
Message #2 by =?iso-8859-1?q?Andrew=20Walker?= <catbert303@y...> on Wed, 15 May 2002 14:09:51 +0100 (BST)
There isn't really much difference between using ' or
" for simple strings like $name = 'bill'; although
using the ' quotes gets processed slightly faster than
using ", this is because you can use the double quotes
to concatenate variables something like this

$name = 'bill';
$pageName = 'my page';
$welcome = "hello $name welcome to $pageName";

echo $welcome;
would write hello bill welcome to my page

however,

$welcome = 'hello $name welcome to $pageName';
wouldn't work.

so beacuse PHP doesn't go through any single quoted
strings looking for variables like it does in double
quoted strings, it processes single quotes (slightly)
faster.

Andy.

 --- Josh <jeb_braun@i...> wrote: > I
found this article "PHP Guidelines" and what it
> said in some parts is 
> different than what Beginning PHP4 says. For example
> In the book for assigning varibles to do like this
> $name = "Bill"
> and in the article to do like this
> $name = 'Bill'
> 
> Just wondering if some of the things in the article
> are the right way to 
> do it because the book is a couple years old and PHP
> might have changed or 
> something. Here is the address of the article 
>
http://www.evolt.org/article/PHP_Guidelines/17/26440/index.html
> 
> Just what to know so if the article is right then I
> would like to start 
> doing stuff the right way before I get used to the
> wrong way. Thanks

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
Message #3 by "Nikolai Devereaux" <yomama@U...> on Wed, 15 May 2002 11:23:57 -0700
For more information about string parsing, read the manual at
  http://www.php.net/types.string

It's pretty readable, shows a lot of examples, and is really really
informative and useful.


nik

Message #4 by =?iso-8859-1?q?Johno?= <omokore@y...> on Wed, 15 May 2002 23:16:39 +0100 (BST)
Thanks Guys - Problem has been solved!
 --- Nikolai Devereaux <yomama@U...> wrote: > 
> For more information about string parsing, read the
> manual at
>   http://www.php.net/types.string
> 
> It's pretty readable, shows a lot of examples, and
> is really really
> informative and useful.
> 
> 
> nik
> 
> 

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

  Return to Index