Re: whoami explanation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2009-03-03 at 10:57 -0500, PJ wrote:
> Per Jessen wrote:
> > PJ wrote:
> >
> >   
> >> This really needs some explanation
> >> I found this on the web:
> >> <?php echo `whoami`; ?>
> >> with it there was the comment "the direction of those single-quotes
> >> matters" (WHY ?) and it works....
> >>
> >>     
> >
> > GIYF - look up "back quotes".
> >
> >   
> >> But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
> >> /command/ ) does not,
> >> COPIED AND PASTED:
> >> |<?php
> >> // outputs the username that owns the running php/httpd process
> >> // (on a system with the "whoami" executable in the path)
> >> echo exec('whoami');
> >> ?> |
> >> What is going on here?
> >>     
> >
> > What sort of error did you get?  (it works fine here).
> >
> >
> > /Per
> >   
> forgot to add:
> What's the difference between back ticks or quotes and regular single
> quotes?
> How does one enter back quotes from the keyboard?

Single quotes don't interpolate (expand) variables within them. They are
for string literals. Only escaping recognized is \\ to include a
backslash and \' to include a single quote. Double quotes recognize all
sorts of escape chars such as \n for newline, \r for carriage return, \t
for tab, etc, etc. Additionally they expand embedded variables to their
value. Backtick key can usually be found to the left of the 1 key and
unders the escape key.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux