p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: NIK: using the require function


Message #1 by "jorge" <jorge@d...> on Tue, 8 Oct 2002 19:41:13 -0500
Dear Nik

I respect you as everybody else in this forum, sorry if I have misspeled
your name it wasnt intentional its just that my mother language is spanish
(I am in Mexico City). thats why i am so lousy writing in english and some
other things too =)

I try to do my best trying to help any body else, I learn from my mistakes
and, like in this case I apreicated any body that point me to the right
direction too. Its just that sound a little hard to me the way you start to
wrote me.

I consider myself as one of your fans in this forum . I collect a lot of
your posts to study them.

I apreciated the great explanations you constantly make.
people dont get me wrong i apreciated also every body elses but Nik´s are
specials ( ahead of the rest).

I beleive this is a great forum.
Nik no problem still have a friend here whether you want it or not.

I am in mexico so if any body that travels here is welcome to call if need
any help while here or just want recomendations.

Nik thanks for your time
dont need to reply to this one
I know you are a great person

Jorge






----- Original Message -----
From: "Nikolai Devereaux" <yomama@u...>
To: "beginning php" <beginning_php@p...>
Sent: Tuesday, October 08, 2002 6:35 PM
Subject: [beginning_php] RE: NICK: using the require function


>
> > If he is concatenating he need to escape the ""
> > other wise "wont work"
> > whats the point in writing more code and more confusing
> > is a lot easier
> > just staight or $DOCUMENT_ROOT/$mypath
> > an he can change that var as he likes keeping his code cleaner
> >
> > and Nick thanks for the insult
>
>
> I wasn't insulting you, Jorge -- no need to take things so personally.
The
> fact remains that you're mistaken.  It's really no big deal -- I make
mistakes
> all the time.
>
>
> John's original code snippet was, and I quote:
>
>  require($DOCUMENT_ROOT . "/members/inc/copyright.inc");
>
> If you look more closely at this, you'll notice that there are two strings
> being concatenated.
>
> The first string is contained in the variable $DOCUMENT_ROOT.
>
> The second string is simply "/members/inc/copyright.inc".
>
>
> You don't need to escape any quotation marks because those are the
delimiters
> of the string, "/members/inc/copyright.inc".
>
> If you were to escape the double quotes, you'd end up with this:
>
>
>  require($DOCUMENT_ROOT . \"/members/inc/copyright.inc\");
>
> which causes a parse error, since the first \ is unexpected.  The
concatenation
> operator expects a string.  This string can come from a function return
value,
> a variable, or a static string.
>
>
> You should also notice that in my previous reply (the one you found
insulting),
> I stated quite simply that your solution was equivalent to John's original
> post.
>
>
> Check it out:
>
> You>  ("$DOCUMENT_ROOT/canitec.../libjc.../conectar.php")
>
> John> ($DOCUMENT_ROOT . "/members/inc/copyright.inc")
>
>
> Me>   ("$foo bar") == ($foo . " bar")
>
>
> $foo, in my example, is $DOCUMENT_ROOT.
>
> ' $bar' is '/members/inc/copyright.inc'
>
> Note:  single-quotes used to stress the leading space in the string, and
> single-quoted strings are identical to double-quoted strings, they just
don't
> perform any special variable and escape-character substitution.
>
>
>
> I am sorry if I've offended you, but it wasn't intentional.
>
>
>
> Also, could you spell my name correctly in the future?  I find it
disrespectful
> when people misspell my name, especially since I sign 99% of my posts with
it.
>
>
> Thanks!
>
> Nik
>
>
>



  Return to Index