I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

am 11.07.2009 02:25:33 von Govinda

How do I get
basename(__FILE__)
or
htmlentities($somevar)
to be evaluated in a heredoc?

------------
Govinda
govinda.webdnatalk@gmail.com


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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 02:32:59 von Eddie Drapkin

On Fri, Jul 10, 2009 at 8:25 PM, Govinda wrot=
e:
> How do I  get
> basename(__FILE__)
> or
> htmlentities($somevar)
> to be evaluated  in a heredoc?
>
> ------------
> Govinda
> govinda.webdnatalk@gmail.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

You actually can't, sorry. At least not as far as I know.

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 02:34:18 von Daniel Brown

On Fri, Jul 10, 2009 at 20:25, Govinda wrote:
> How do I =A0get
> basename(__FILE__)
> or
> htmlentities($somevar)
> to be evaluated =A0in a heredoc?

You don't. Instead, you have to store the output from those in a
variable (or array), then place it into the HEREDOC it.

$somevar =3D htmlentities($somevar);
$filedata =3D array('name' =3D> basename(__FILE__), 'size' =3D> filesize(__=
FILE__));

$html =3D<< File Name: {$filedata['name']}

File Size: {$filedata['size']}


\$somevar: {$somevar}


HTML;

echo $html;
?>



--=20

daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 02:34:57 von zareef ahmed

--0015174c1aac21ef87046e63428f
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Sat, Jul 11, 2009 at 5:55 AM, Govinda wrote:

> How do I get
> basename(__FILE__)
> or
> htmlentities($somevar)
> to be evaluated in a heredoc?
>

heredoc was there to work with the strings... why you want to use functions
into that?


>
> ------------
> Govinda
> govinda.webdnatalk@gmail.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

--0015174c1aac21ef87046e63428f--

Re: I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

am 11.07.2009 02:44:15 von Govinda

On Jul 10, 2009, at 6:34 PM, Zareef Ahmed wrote:

> heredoc was there to work with the strings... why you want to use
> functions into that?

I'm lazy. Like to type less. ;-)

But now I know.
Thanks guys.


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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 14:26:22 von zareef ahmed

--0015174bf1dc5ec4d1046e6d327d
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Sat, Jul 11, 2009 at 6:14 AM, Govinda wrote:

> On Jul 10, 2009, at 6:34 PM, Zareef Ahmed wrote:
>
> heredoc was there to work with the strings... why you want to use
>> functions into that?
>>
>
> I'm lazy. Like to type less. ;-)



It is well known fact that normally only lazy people end up being a good
programmer.
BTW template system like smarty and many MVC pattern framework solved such
issues .... But those are only useful if you are planning something big
(read more than a single page ) and want to put the logic not just for less
typing but also for less complication;
I hope I sound less complicated :)

>
>
> But now I know.
> Thanks guys.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

--0015174bf1dc5ec4d1046e6d327d--

Re: I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

am 11.07.2009 16:23:55 von TedD

At 8:34 PM -0400 7/10/09, Daniel Brown wrote:
>On Fri, Jul 10, 2009 at 20:25, Govinda wrote:
>> How do I get
>> basename(__FILE__)
>> or
>> htmlentities($somevar)
>> to be evaluated in a heredoc?
>
> You don't. Instead, you have to store the output from those in a
>variable (or array), then place it into the HEREDOC it.
>
> >$somevar = htmlentities($somevar);
>$filedata = array('name' => basename(__FILE__), 'size' => filesize(__FILE__));
>
>$html =<< >File Name: {$filedata['name']}

>File Size: {$filedata['size']}

>
>\$somevar: {$somevar}

>
>HTML;
>
>echo $html;
>?>

Daniel:

Why the braces?

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

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

Re: I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

am 11.07.2009 16:42:08 von Ashley Sheridan

On Saturday 11 July 2009 15:23:55 tedd wrote:
> At 8:34 PM -0400 7/10/09, Daniel Brown wrote:
> >On Fri, Jul 10, 2009 at 20:25, Govinda wrote:
> >> How do I get
> >> basename(__FILE__)
> >> or
> >> htmlentities($somevar)
> >> to be evaluated in a heredoc?
> >
> > You don't. Instead, you have to store the output from those in a
> >variable (or array), then place it into the HEREDOC it.
> >
> > > >$somevar = htmlentities($somevar);
> >$filedata = array('name' => basename(__FILE__), 'size' =>
> > filesize(__FILE__));
> >
> >$html =<< > >File Name: {$filedata['name']}

> >File Size: {$filedata['size']}

> >
> >\$somevar: {$somevar}

> >
> >HTML;
> >
> >echo $html;
> >?>
>
> Daniel:
>
> Why the braces?
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com

The braces ensure that PHP doesn't stop parsing the variable name once it
reaches the [. By default, it will only match a variable name up to the [
sign, so you couldn't access arrays without the braces.


--
Thanks,
Ash
http://www.ashleysheridan.co.uk

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 17:03:19 von Daniel Brown

On Sat, Jul 11, 2009 at 10:42, Ashley Sheridan wrote:
>
> The braces ensure that PHP doesn't stop parsing the variable name once it
> reaches the [. By default, it will only match a variable name up to the [
> sign, so you couldn't access arrays without the braces.

Couldn't have said it better myself.

As for the braces in the HEREDOC around {$somevar}, while it works
absolutely fine, it was a typo on my part: I intended to show all
manner of usage and processing of variables within the HEREDOC syntax.
However, in my own code, I generally include all variables between
{braces} when inside a HEREDOC block. Sheer preference for
readability in a large HEREDOC: because I don't normally use curly
braces around variables, when I see that on the page, I instantly
recognize that I'm still in the block (if all other clues miraculously
fail --- and we all know that they sometimes do).

--

daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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

Re: I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

am 11.07.2009 17:05:55 von TedD

At 3:42 PM +0100 7/11/09, Ashley Sheridan wrote:
>On Saturday 11 July 2009 15:23:55 tedd wrote:
> > At 8:34 PM -0400 7/10/09, Daniel Brown wrote:
>-snip-
> > >$html =<< >> >File Name: {$filedata['name']}

>> >File Size: {$filedata['size']}

>> >
> > >\$somevar: {$somevar}

>> >
> > >HTML;
>> >
>> >echo $html;
>> >?>
>>
> > Daniel:
>>
> > Why the braces?
> >
> > tedd
>
>The braces ensure that PHP doesn't stop parsing the variable name once it
>reaches the [. By default, it will only match a variable name up to the [
>sign, so you couldn't access arrays without the braces.
>
>Ash

Ash:

Ahhh, the arrays -- I should have looked further up.

I just noticed:

\$somevar: {$somevar}


and wondered why, because:

\$somevar: $somevar


will work.

Side note: Paul Novitski showed me using an underscore for heredocs:

$html =<<<_
whatever
_;

That I thought was kind of neat. To me it makes heredocs stand out
and are more uniform.

In any event, thanks,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 17:23:11 von Daniel Brown

On Sat, Jul 11, 2009 at 11:05, tedd wrote:
>
> Side note: Paul Novitski showed me using an underscore for heredocs:
>
> $html =<<<_
> whatever
> _;
>
> That I thought was kind of neat. To me it makes heredocs stand out and are
> more uniform.

I used $html =<< HTML+PHP in Vim, and as many know, almost everything I do is from the
command line and Vim.

--

daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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

Re: I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

am 11.07.2009 17:31:43 von Ashley Sheridan

On Saturday 11 July 2009 16:05:55 tedd wrote:
> At 3:42 PM +0100 7/11/09, Ashley Sheridan wrote:
> >On Saturday 11 July 2009 15:23:55 tedd wrote:
> > > At 8:34 PM -0400 7/10/09, Daniel Brown wrote:
> >
> >-snip-
> >
> > > >$html =<< > >> >
> >> >File Name: {$filedata['name']}

> >> >File Size: {$filedata['size']}

> >> >
> > > >\$somevar: {$somevar}

> > > >
> > > >HTML;
> >> >
> >> >echo $html;
> >> >?>
> > >
> > > Daniel:
> > >
> > > Why the braces?
> > >
> > > tedd
> >
> >The braces ensure that PHP doesn't stop parsing the variable name once it
> >reaches the [. By default, it will only match a variable name up to the [
> >sign, so you couldn't access arrays without the braces.
> >
> >Ash
>
> Ash:
>
> Ahhh, the arrays -- I should have looked further up.
>
> I just noticed:
>
> \$somevar: {$somevar}

>
> and wondered why, because:
>
> \$somevar: $somevar

>
> will work.
>
> Side note: Paul Novitski showed me using an underscore for heredocs:
>
> $html =<<<_
> whatever
> _;
>
> That I thought was kind of neat. To me it makes heredocs stand out
> and are more uniform.
>
> In any event, thanks,
>
> tedd
>
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com

I would try to avoid heredoc delimiters of a single character, just in case ;)

What I tend to do is to use << what content I'm outputting. It makes no difference, but reading back later
it helos me understand what I was doing. So I'd use EOX for XML, EOF for
forms, OEC for general content, etc.

I only do it this way because I remember reading somewhere (If forget exactly
where now) that it is better to use 3 or more characters in uppercase so they
stand out well from the rest of the code.

--
Thanks,
Ash
http://www.ashleysheridan.co.uk

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

Re: I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

am 11.07.2009 17:32:34 von Ashley Sheridan

On Saturday 11 July 2009 16:23:11 Daniel Brown wrote:
> On Sat, Jul 11, 2009 at 11:05, tedd wrote:
> > Side note: Paul Novitski showed me using an underscore for heredocs:
> >
> > $html =<<<_
> > whatever
> > _;
> >
> > That I thought was kind of neat. To me it makes heredocs stand out and
> > are more uniform.
>
> I used $html =<< > HTML+PHP in Vim, and as many know, almost everything I do is from the
> command line and Vim.
>
> --
>
> daniel.brown@parasane.net || danbrown@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> Check out our great hosting and dedicated server deals at
> http://twitter.com/pilotpig

Now that is very useful to know! I'm going to try that out to see if other
*nix editors handle it the same way

--
Thanks,
Ash
http://www.ashleysheridan.co.uk

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

Re: I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

am 11.07.2009 18:16:28 von TedD

At 11:23 AM -0400 7/11/09, Daniel Brown wrote:
> and as many know, almost everything I do is from the
>command line

I stopped using the command-line when I moved from my old Apple ][ to the Mac.

I know I should get back into it, but there is so much there it's
overwhelming. Using the terminal command-line on the Mac is one of
those things I have on my list of things to learn.

Right now, I have my hands/head full learning Eclipse for PHP -- boy,
there's a lot there. It seems the more I learn, the more I need to
learn.

I said a long time ago:

"I've learned something new everyday of my life -- and I'm getting
damned tried of it."

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 19:26:50 von Eddie Drapkin

On Sat, Jul 11, 2009 at 11:03 AM, Daniel Brown wrote:
> On Sat, Jul 11, 2009 at 10:42, Ashley Sheridan =
wrote:
>>
>> The braces ensure that PHP doesn't stop parsing the variable name once i=
t
>> reaches the [. By default, it will only match a variable name up to the =
[
>> sign, so you couldn't access arrays without the braces.
>
>    Couldn't have said it better myself.
>
>    As for the braces in the HEREDOC around {$somevar}, while it=
works
> absolutely fine, it was a typo on my part: I intended to show all
> manner of usage and processing of variables within the HEREDOC syntax.
>  However, in my own code, I generally include all variables between
> {braces} when inside a HEREDOC block.  Sheer preference for
> readability in a large HEREDOC: because I don't normally use curly
> braces around variables, when I see that on the page, I instantly
> recognize that I'm still in the block (if all other clues miraculously
> fail --- and we all know that they sometimes do).
>
> --
>
> daniel.brown@parasane.net || danbrown@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> Check out our great hosting and dedicated server deals at
> http://twitter.com/pilotpig
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Uhm.... you don't need braces around arrays unless you're using more
than one dimension in the array.

This works perfectly fine for me:

$bar =3D array('hello' =3D> "goodbye");

$foo =3D << $bar[hello]
EOT;

echo $foo; //echos out goodbye
?>

Something this simple should be common knowledge :X but I still agree
with Daniel that you ought to use {} around variables in HEREDOC (or
double-quotes) as it makes your code much more readable.

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 19:35:25 von Daniel Brown

On Sat, Jul 11, 2009 at 13:26, Eddie Drapkin wrote:
>
> Uhm.... you don't need braces around arrays unless you're using more
> than one dimension in the array.
>
> This works perfectly fine for me:
>
> > $bar =3D array('hello' =3D> "goodbye");
>
> $foo =3D << > $bar[hello]
> EOT;
>
> echo $foo; =A0//echos out goodbye
> ?>

It works fine because you're forcing PHP to cast 'hello' in your
array from a simple boolean TRUE to the string equivalent. Bad,
Eddie! Stay off the couch!

> Something this simple should be common knowledge :X but I still agree
> with Daniel that you ought to use {} around variables in HEREDOC (or
> double-quotes) as it makes your code much more readable.

It also works similar to the method in which double quotes
(translatable) work as opposed to single quotes (literal), though
instead of printing the literal $bar['hello'] it will give you a parse
error (T_ENCAPSED_AND_WHITESPACE, if memory serves correctly for once,
but don't quote me on that).

--=20

daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 19:41:57 von Daniel Brown

On Sat, Jul 11, 2009 at 13:35, Daniel Brown wrote:
>
> =A0 =A0It works fine because you're forcing PHP to cast 'hello' in your
> array from a simple boolean TRUE to the string equivalent.

sed "s/string equivalent/literal 'hello' string/g"

(The way I'd worded it before seemed to me, upon re-reading it,
like I was implying it would cast the boolean TRUE to the string
'TRUE'.)

--=20

daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 19:45:55 von Eddie Drapkin

On Sat, Jul 11, 2009 at 1:41 PM, Daniel Brown wrote:
> On Sat, Jul 11, 2009 at 13:35, Daniel Brown wrote:
>>
>>    It works fine because you're forcing PHP to cast 'hello' in=
your
>> array from a simple boolean TRUE to the string equivalent.
>
>    sed "s/string equivalent/literal 'hello' string/g"
>
>    (The way I'd worded it before seemed to me, upon re-reading =
it,
> like I was implying it would cast the boolean TRUE to the string
> 'TRUE'.)
>
> --
>
> daniel.brown@parasane.net || danbrown@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> Check out our great hosting and dedicated server deals at
> http://twitter.com/pilotpig
>

If that's true, then we've found an error reporting bug! I've never
seen an error/warning raised, even with my usual
"error_reporting(E_ALL | E_STRICT | E_DEPRACATED)"! The warning is
raised here, though:
$foo =3D $bar[hello];

but not here:
$foo =3D "$bar[hello]"

At the risk of sounding like an inane ass, I quote, from php.net/strings:

"With array indices, the closing square bracket (]) marks the end of
the index. The same rules apply to object properties as to simple
variables."

Sorry if I sound like an ass, just trying to defend myself from having
to go change several thousand array items referenced from doublequotes
/ HEREDOC.

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 20:01:41 von Daniel Brown

On Sat, Jul 11, 2009 at 13:45, Eddie Drapkin wrote:
>
> If that's true, then we've found an error reporting bug! I've never
> seen an error/warning raised, even with my usual
> "error_reporting(E_ALL | E_STRICT | E_DEPRACATED)"! =A0The warning is
> raised here, though:
> $foo =3D $bar[hello];
>
> but not here:
> $foo =3D "$bar[hello]"

No, we're crossing subjects here, actually. The error would be
raised in something such as the following:


$bar['hello'] =3D 'World!';
$bar['world'] =3D 'Hello,';

$foo =3D << $bar['world'] $bar['hello']
EOT;

echo $foo."\n";
?>

> Sorry if I sound like an ass, just trying to defend myself from having
> to go change several thousand array items referenced from doublequotes
> / HEREDOC.

You don't sound like an ass at all (quite the contrary, actually),
and not changing them certainly isn't the end of the world.

--=20

daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 20:15:33 von Eddie Drapkin

On Sat, Jul 11, 2009 at 2:01 PM, Daniel Brown wrote:
> On Sat, Jul 11, 2009 at 13:45, Eddie Drapkin wrote:
>>
>> If that's true, then we've found an error reporting bug! I've never
>> seen an error/warning raised, even with my usual
>> "error_reporting(E_ALL | E_STRICT | E_DEPRACATED)"!  The warning is
>> raised here, though:
>> $foo =3D $bar[hello];
>>
>> but not here:
>> $foo =3D "$bar[hello]"
>
>    No, we're crossing subjects here, actually.  The error =
would be
> raised in something such as the following:
>
> >
> $bar['hello'] =3D 'World!';
> $bar['world'] =3D 'Hello,';
>
> $foo =3D << > $bar['world'] $bar['hello']
> EOT;
>
> echo $foo."\n";
> ?>
>

Yeah, that (echo "$bar['hello']") would raise an error the same way as
if you had said:
echo $bar['\'hello\''];
because, as far as my understand goes, the array key "word" inside the
doublequotes/heredoc is literally evaluated, so it'll look for the
literal 'hello' key instead of the literal hello key, if that makes
sense given the lack of formatting on my part. It looks like, when in
lexing mode inside of doublequotes/heredoc, the lexer stops lexing at
the first ] after a $ and inside the square bracketed "word", it
interprets it as a hash table key, rather than as the literal word,
which would be cast to a string (as an undefined constant) and then
used as a hash table key outside of "lexing mode" (which is probably
not the right way to describe what's going on inside heredoc or
doublequotes).

>    You don't sound like an ass at all (quite the contrary, actu=
ally),
> and not changing them certainly isn't the end of the world.

Alright, was just a tad worried ;)

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 20:43:20 von Daniel Brown

On Sat, Jul 11, 2009 at 14:15, Eddie Drapkin wrote:
>
[snip!]
> which would be cast to a string (as an undefined constant) and then
[snip!]

That's exactly the point I was waiting for someone to make. I
wanted someone to question why it was a Bad Idea[TM] to leave the key
unquoted and typecast. I even tried to make a big enough deal about
it so as to draw attention, but not make the answer plainly-obvious.
And there ya' go. (Sorry, I feel like I'm in Teacher Mode today.... I
don't mean to come off as condescending, if I am.)

Q: Why should I use quotes in my array keys?
A: Because, while it can be typecast to the literal string, it
will be translated to the value of a previously-defined constant if
one exists by the same name.

.... but wait, there's more! This is where it gets fun and confusing.

When inside of a HEREDOC, all non-braced array variables' array
keys are forced literals, as opposed to translatables when the array
variable is braced. The following example (hopefully) will help to
explain what I mean:


$bar[apple] = 'Apple';
$bar[orange] = 'Orange';

define(apple,'orange');

echo $bar['apple']."\n"; // Apple - Quoting causes the literal string
to grab the typecast string
echo $bar[apple]."\n"; // Orange - The unquoted string is prioritized
as the defined constant

$foo = << $bar[apple] $bar[orange]
EOT;

$oof =<< {$bar[apple]} {$bar[orange]}
EOT;

echo $foo."\n"; // Apple Orange - $bar[apple] is translated as a
whole, apple is not
echo $oof."\n"; // Orange Orange - apple is translated first into
orange, making both $bar[orange]
?>


--

daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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

Re: I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

am 11.07.2009 21:53:56 von Govinda

On Jul 11, 2009, at 11:26 AM, Eddie Drapkin wrote:

> $foo = << > $bar[hello]
> EOT;

what does "EOT" stand for?
(I realize that string can be anything.. but I am just asking what
EOT means to everyone?

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 21:56:16 von Eddie Drapkin

On Sat, Jul 11, 2009 at 3:53 PM, Govinda wrot=
e:
> On Jul 11, 2009, at 11:26 AM, Eddie Drapkin wrote:
>
>> $foo =3D << >> $bar[hello]
>> EOT;
>
> what does "EOT" stand for?
> (I realize that string can be anything..  but I am just asking what =
EOT
> means to everyone?


I just use it as "End of Term" because I'm used to "EOF" as "End of File"

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 22:34:44 von 9el

--0016364c673f1669d5046e74069c
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Sun, Jul 12, 2009 at 2:56 AM, Eddie Drapkin wrote:

> On Sat, Jul 11, 2009 at 3:53 PM, Govinda
> wrote:
> > On Jul 11, 2009, at 11:26 AM, Eddie Drapkin wrote:
> >
> >> $foo = << > >> $bar[hello]
> >> EOT;
> >
> > what does "EOT" stand for?
> > (I realize that string can be anything.. but I am just asking what EOT
> > means to everyone?
>
>
> I just use it as "End of Term" because I'm used to "EOF" as "End of File"


EOT used to mean End of Text. reference ASCII-7 notatioin

--0016364c673f1669d5046e74069c--

Re: I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

am 11.07.2009 23:37:07 von TedD

At 3:34 AM +0700 7/12/09, Lenin wrote:
>On Sun, Jul 12, 2009 at 2:56 AM, Eddie Drapkin wrote:
>
>> On Sat, Jul 11, 2009 at 3:53 PM, Govinda
> > wrote:
> > > what does "EOT" stand for?
>> > (I realize that string can be anything.. but I am just asking what EOT
> > > means to everyone?
> >
> > I just use it as "End of Term" because I'm used to "EOF" as "End of File"
>
>EOT used to mean End of Text. reference ASCII-7 notatioin


Yes, but in both cases the operator is used at both the beginning AND
at the end of the heredoc. I normally don't start anything with an
"End" term.

That's what I liked about the underscore (_) -- there's no inference
that it's an acronym.

$whatever = <<<_
whatever
_;

However with that said, one could come up with a dual purpose acronym like:

TO = (TEXT On or TEXT Off)

or if you need three characters.

HDO = (HEREDOC ON or HEREDOC OFF)

I'm sure some clever person could come up with something better.

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

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

Re: I am RTFM, but still stumbling on how to get built-in

am 11.07.2009 23:57:13 von Daniel Brown

On Sat, Jul 11, 2009 at 17:37, tedd wrote:
>
> I'm sure some clever person could come up with something better.

Probably not.

Now, on to NOWDOC....

--

daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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

Re: I am RTFM, but still stumbling on how to get built-in

am 12.07.2009 01:20:06 von Eddie Drapkin

On Sat, Jul 11, 2009 at 5:37 PM, tedd wrote:
> At 3:34 AM +0700 7/12/09, Lenin wrote:
>>
>> On Sun, Jul 12, 2009 at 2:56 AM, Eddie Drapkin wrot=
e:
>>
>>>  On Sat, Jul 11, 2009 at 3:53 PM, Govinda ..com>
>>
>>  > wrote:
>>  > > what does "EOT" stand for?
>>>
>>>  > (I realize that string can be anything..  but I am just as=
king what
>>> EOT
>>
>>  > > means to everyone?
>>  >
>>  > I just use it as "End of Term" because I'm used to "EOF" as "End=
of
>> File"
>>
>> EOT used to mean  End of Text. reference ASCII-7 notatioin
>
>
> Yes, but in both cases the operator is used at both the beginning AND at =
the
> end of the heredoc. I normally don't start anything with an "End" term.
>
> That's what I liked about the underscore (_) -- there's no inference that
> it's an acronym.
>
> $whatever =3D <<<_
> whatever
> _;
>
> However with that said, one could come up with a dual purpose acronym lik=
e:
>
> TO  =3D (TEXT On or TEXT Off)
>
> or if you need three characters.
>
> HDO =3D (HEREDOC ON or HEREDOC OFF)
>
> I'm sure some clever person could come up with something better.
>
> Cheers,
>
> tedd


When I see something like

$foo =3D <<
//stuff

EOT;

I always read "<< So, the whole statement, in my head, would be "$foo is equal to
everything following until End of Text." Although, less generic names
like HTML, or XML, or ROW can also be fine, too.

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

Re: I am RTFM, but still stumbling on how to get built-in

am 12.07.2009 01:46:19 von zareef ahmed

--0015174be6280ad8b3046e76b252
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

I always said : Being good and Being FORCED to be good are two different
things... and PHP normally don't force us to be good that why PHP is the
most popular programming language with a large code base which WORKS but
not as per the standard or recommended way ; so keep you old code as long as
it works....

Sorry for TOP posting .... This mailing list also don't force us to be good
:)

Zareef Ahmed

On Sun, Jul 12, 2009 at 4:50 AM, Eddie Drapkin wrote:

> On Sat, Jul 11, 2009 at 5:37 PM, tedd wrote:
> > At 3:34 AM +0700 7/12/09, Lenin wrote:
> >>
> >> On Sun, Jul 12, 2009 at 2:56 AM, Eddie Drapkin
> wrote:
> >>
> >>> On Sat, Jul 11, 2009 at 3:53 PM, Govinda > >
> >>
> >> > wrote:
> >> > > what does "EOT" stand for?
> >>>
> >>> > (I realize that string can be anything.. but I am just asking what
> >>> EOT
> >>
> >> > > means to everyone?
> >> >
> >> > I just use it as "End of Term" because I'm used to "EOF" as "End of
> >> File"
> >>
> >> EOT used to mean End of Text. reference ASCII-7 notatioin
> >
> >
> > Yes, but in both cases the operator is used at both the beginning AND at
> the
> > end of the heredoc. I normally don't start anything with an "End" term.
> >
> > That's what I liked about the underscore (_) -- there's no inference that
> > it's an acronym.
> >
> > $whatever = <<<_
> > whatever
> > _;
> >
> > However with that said, one could come up with a dual purpose acronym
> like:
> >
> > TO = (TEXT On or TEXT Off)
> >
> > or if you need three characters.
> >
> > HDO = (HEREDOC ON or HEREDOC OFF)
> >
> > I'm sure some clever person could come up with something better.
> >
> > Cheers,
> >
> > tedd
>
>
> When I see something like
>
> $foo = << >
> //stuff
>
> EOT;
>
> I always read "<< > So, the whole statement, in my head, would be "$foo is equal to
> everything following until End of Text." Although, less generic names
> like HTML, or XML, or ROW can also be fine, too.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

--0015174be6280ad8b3046e76b252--

Re: I am RTFM, but still stumbling on how to get built-in

am 12.07.2009 01:49:14 von Daniel Brown

On Sat, Jul 11, 2009 at 19:46, Zareef Ahmed wrote:
> I always said : =A0Being good and Being FORCED to be good =A0are two diff=
erent
> things... and PHP normally don't force us to be good that why PHP is the
> most popular programming language with a large code base which WORKS but
> not as per the standard or recommended way ; so keep you old code as long=
as
> it works....

Well, it's not the most popular, but it's right up at the top.

> Sorry for TOP posting .... This mailing list also don't force us to be go=
od
> :)

FORCE, no. ENCOURAGE, yes. Particularly in long threads like
this one. Check the rules. They're not just there to take up space
on the paper. ;-P

--=20

daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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

Re: I am RTFM, but still stumbling on how to get built-in

am 12.07.2009 09:05:05 von 9el

--0016364c673f665435046e7cd4ae
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Sun, Jul 12, 2009 at 6:49 AM, Daniel Brown wrote:

>
> > Sorry for TOP posting .... This mailing list also don't force us to be
> good
> > :)
>
> FORCE, no. ENCOURAGE, yes. Particularly in long threads like
> this one. Check the rules. They're not just there to take up space
> on the paper. ;-P

If I reply from my Nokia 6020's wap (as gmail app would hang now due to less
memory) and I include the receiver's text I cant choose to place it at top
or bottom. So, that way it would always be top posting.

Also from that wap device you will have REAL difficulty if mails are not TOP
posted. Because, then you'd have to scroll all the pages by clicking "next
message">> "next message" blah blah blah.

Of course it is better for reading if mails are written bottom posted or
inline answered.

Regards

Lenin

--0016364c673f665435046e7cd4ae--

Re: I am RTFM, but still stumbling on how to get built-in

am 12.07.2009 09:08:40 von Eddie Drapkin

On Sun, Jul 12, 2009 at 3:05 AM, Lenin wrote:
> On Sun, Jul 12, 2009 at 6:49 AM, Daniel Brown wrote:
>>
>> > Sorry for TOP posting .... This mailing list also don't force us to be
>> > good
>> > :)
>>
>>    FORCE, no.  ENCOURAGE, yes.  Particularly in long=
threads like
>> this one.  Check the rules.  They're not just there to take up=
space
>> on the paper.  ;-P
>
> If I reply from my Nokia 6020's wap (as gmail app would hang now due to l=
ess
> memory) and I include the receiver's text I cant choose to place it at to=
p
> or bottom. So, that way it would always be top posting.
>
> Also from that wap device you will have REAL difficulty if mails are not =
TOP
> posted. Because, then you'd have to scroll all the pages by clicking "nex=
t
> message">> "next message" blah blah blah.
>
> Of course it is better for reading if mails are written bottom posted or
> inline answered.
>
> Regards
>
> Lenin
>

Two things:
1) I've never head of an email list changing their rules to cater to a
fringe crowd, like Nokia 6020 users.
2) Why does every thread lately degrade into chatter about top/bottom
posting? *looks RIGHT AT D. Brown*

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

Re: I am RTFM, but still stumbling on how to get built-in

am 12.07.2009 09:11:39 von 9el

--00163646c94ade7f8e046e7cebf0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Sun, Jul 12, 2009 at 2:08 PM, Eddie Drapkin wrote:

> 2) Why does every thread lately degrade into chatter about top/bottom
> posting? *looks RIGHT AT D. Brown*
>

Ask him :D :P

--00163646c94ade7f8e046e7cebf0--

Re: I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

am 12.07.2009 14:43:49 von TedD

At 5:16 AM +0530 7/12/09, Zareef Ahmed wrote:
>I always said : Being good and Being FORCED to be good are two
>different things... and PHP normally don't force us to be good that
>why PHP is the most popular programming language with a large code
>base which WORKS but not as per the standard or recommended way ;
>so keep you old code as long as it works....
>
>Sorry for TOP posting .... This mailing list also don't force us to be good :)
>
>Zareef Ahmed
>

Yes, and unfortunately mailing list also don't force people to trim
their post as well.

You know I have difficulty understanding the rudeness and lack of
respect that a few people have with just following the simple rules
of a mailing list. They post to this list as if they can say and do
anything without it mattering. They don't care if others have to wade
through their nonsense in an attempt to find the point. They don't
care if their post don't help others for posterity. They even don't
care that their posts are of public record displaying their rudeness
and lack of professionalism for all to see, including potential
employers and clients.

I don't understand such lack of respect for themselves and others.

While I have no control over what people do on this list, I do have
control over what I do. So, when I encounter people who create more
problems than they are worth, then I stop posting answers to their
questions. I figure that if they don't get their questions answered,
then they can go elsewhere, which improves the quality of this list.

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

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

Re: I am RTFM, but still stumbling on how to get built-in

am 12.07.2009 17:00:18 von Daniel Brown

On Sun, Jul 12, 2009 at 03:08, Eddie Drapkin wrote:
>
> Two things:
> 1) I've never head of an email list changing their rules to cater to a
> fringe crowd, like Nokia 6020 users.
> 2) Why does every thread lately degrade into chatter about top/bottom
> posting? *looks RIGHT AT D. Brown*

Re: (2) ---
Look at who put the comment out there prior to my response,
and then look through the archives.... you'll see it's not "lately."
However, there are many more people posting all throughout thread
positions, wherever they feel, so it garners a mention, because many
may not be aware that no-top-posting is a written rule here.

(Looks back at Eddie, stares him down, then blows a kiss at him,
causing Eddie to throw up in his mouth a little.)

--

daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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

Re: I am RTFM, but still stumbling on how to get built-in

am 13.07.2009 03:54:53 von Paul M Foster

On Sat, Jul 11, 2009 at 11:23:11AM -0400, Daniel Brown wrote:




>
> I used $html =<< > HTML+PHP in Vim, and as many know, almost everything I do is from the
> command line and Vim.

Vim FTW! (And mutt for the pwnage!)

Paul

--
Paul M. Foster

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