On Tue, Mar 3, 2009 at 10:42, PJ <af.gourmet@xxxxxxxxxxxx> 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 ?) Those are called "backtick operators." Like in BASh and most other *NIX shells, that instructs the parser to evaluate, execute, and return the result of the command within the ticks. > 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 you want to do with exec() is run it properly (RTFM for real ;-P). <?php exec('whoami',$ret,$err); echo $ret[0]."\n"; ?> The second parameter passed to exec() is the return array from STDOUT, the third is the error response on channel 2 (STDERR). > And I often find such discrepancies in examples - and some wonder why I > seem to be so stupid... and don't know the fundamentals... :-\ I highly doubt that you're stupid.... you just need to pay closer attention to what the manual is actually saying. Check the user notes as well, and then devise your own pattern from the collective examples --- it'll jump-start your learning. -- </Daniel P. Brown> daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php