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

2009-07-12 Thread 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



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

2009-07-12 Thread 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.br...@parasane.net || danbr...@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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-12 Thread 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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-12 Thread Lenin
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


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

2009-07-12 Thread 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 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
>

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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-12 Thread Lenin
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


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

2009-07-11 Thread Daniel Brown
On Sat, Jul 11, 2009 at 19:46, 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

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 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

-- 

daniel.br...@parasane.net || danbr...@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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread Zareef Ahmed
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


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

2009-07-11 Thread 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  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 = <

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

2009-07-11 Thread 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.br...@parasane.net || danbr...@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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread Lenin
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


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

2009-07-11 Thread Eddie Drapkin
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"

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



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

2009-07-11 Thread Govinda

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


$foo = <<

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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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:




-- 

daniel.br...@parasane.net || danbr...@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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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 = $bar[hello];
>>
>> but not here:
>> $foo = "$bar[hello]"
>
>    No, we're crossing subjects here, actually.  The error would be
> raised in something such as the following:
>
> 
> $bar['hello'] = 'World!';
> $bar['world'] = 'Hello,';
>
> $foo = << $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, actually),
> 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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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)"!  The warning is
> raised here, though:
> $foo = $bar[hello];
>
> but not here:
> $foo = "$bar[hello]"

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



> 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.

-- 

daniel.br...@parasane.net || danbr...@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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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.br...@parasane.net || danbr...@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 = $bar[hello];

but not here:
$foo = "$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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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 = array('hello' => "goodbye");
>
> $foo = << $bar[hello]
> EOT;
>
> echo $foo;  //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).

-- 

daniel.br...@parasane.net || danbr...@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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread Daniel Brown
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.br...@parasane.net || danbr...@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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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 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.br...@parasane.net || danbr...@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:

 "goodbye");

$foo = <<

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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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.br...@parasane.net || danbr...@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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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 <

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

2009-07-11 Thread 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 =<<
daniel.br...@parasane.net || danbr...@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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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.br...@parasane.net || danbr...@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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread 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.

 basename(__FILE__), 'size' => filesize(__FILE__));

$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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-11 Thread Zareef Ahmed
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


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

2009-07-10 Thread 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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-10 Thread Zareef Ahmed
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.webdnat...@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


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

2009-07-10 Thread Daniel Brown
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.

 basename(__FILE__), 'size' => filesize(__FILE__));

$html =<



-- 

daniel.br...@parasane.net || danbr...@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: [PHP] I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

2009-07-10 Thread Eddie Drapkin
On Fri, Jul 10, 2009 at 8:25 PM, Govinda wrote:
> How do I  get
> basename(__FILE__)
> or
> htmlentities($somevar)
> to be evaluated  in a heredoc?
>
> 
> Govinda
> govinda.webdnat...@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