Using backstick in PHP

  • Carol
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Apr 19, 2004
  • Posts: 14
  • Loc: Indonesia
  • Status: Offline

Post April 21st, 2004, 11:44 pm

I aready set safe_mode become off but I still cannot use backstick in PHP. Example:This command does not give result: echo `ls -la`;
Could you help me?
Thanks
Carol
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 21st, 2004, 11:44 pm

  • Axe
  • Genius
  • Genius
  • User avatar
  • Joined: Jan 07, 2004
  • Posts: 5744
  • Loc: Sub-level 28
  • Status: Offline

Post April 22nd, 2004, 10:26 am

Not without seeing your source :)
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Joined: Jun 15, 2003
  • Posts: 4583
  • Loc: Maryland
  • Status: Offline

Post April 22nd, 2004, 5:27 pm

You mean you wish to use ` instead of '? or what? this won't work:

PHP Code: [ Select ]
 
<?
 
echo `Hello World!`;
 
//but this will:
 
echo 'Hello World';
 
//so will this:
 
echo "Hello World";
 
?>
 
 
  1.  
  2. <?
  3.  
  4. echo `Hello World!`;
  5.  
  6. //but this will:
  7.  
  8. echo 'Hello World';
  9.  
  10. //so will this:
  11.  
  12. echo "Hello World";
  13.  
  14. ?>
  15.  
  16.  
Pixel Acres V2
  • Carol
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Apr 19, 2004
  • Posts: 14
  • Loc: Indonesia
  • Status: Offline

Post April 22nd, 2004, 5:50 pm

I read in PHP manual that I can use command with backstick. Example like this:
<?php
echo `ls -la`;
?>
but when I run it, it has no response. So I worry is there any condition to run that command. (It is backstick not single quote)
Please help me once again.
Thanks.
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Joined: Jun 15, 2003
  • Posts: 4583
  • Loc: Maryland
  • Status: Offline

Post April 22nd, 2004, 6:11 pm

Could you show me the page you saw that on? I've never heard of being able to use backsticks instead of quotes. I'll go look but I am doubtful.
Pixel Acres V2
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Joined: Jun 15, 2003
  • Posts: 4583
  • Loc: Maryland
  • Status: Offline

Post April 22nd, 2004, 6:15 pm

The manual doesn't show any support for delimiting strings with backsticks. See here:
http://www.php.net/manual/en/language.types.string.php

Nor does the echo function have any "special" features allowing backsticks, or non stated.

I have never, in over two years seen backsticks in place of quotes.
Pixel Acres V2
  • Carol
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Apr 19, 2004
  • Posts: 14
  • Loc: Indonesia
  • Status: Offline

Post April 22nd, 2004, 11:15 pm

I didnot have mean that can use backstick instead of quote. I say again my problem is I use backstick but it has no response, I worry someone will think backstick (`) is single quote(') so I aready said that it is backstick not quote. Please read it again.
Do you understand I mean?
So do you know how can I run that command?
Thanks so much
  • _Leo_
  • Proficient
  • Proficient
  • User avatar
  • Joined: Feb 17, 2004
  • Posts: 279
  • Loc: Buenos Aires, Argentina
  • Status: Offline

Post April 23rd, 2004, 6:33 am

Well, I couldn't find any support for backstick (like shell backstick) in PHP site.

popen() will solve your problem instead. Take a look to this manual page -> http://ar2.php.net/manual/en/function.popen.php
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Joined: Jun 15, 2003
  • Posts: 4583
  • Loc: Maryland
  • Status: Offline

Post April 23rd, 2004, 12:00 pm

Well I just realised you were using Ls and not is (as in the word). So I didn't realize you were trying to run the command. echo does not run commands, it only outputs data, and that is done either through the returned value of a function, value of a variable, or value contained in the string.

Like I said, I have never seen backstick's used in php. The only time I've ever used them is to make my mysql queries neater, and they are nested inside of quotes which makes it just like any other of the 255 characters.
Pixel Acres V2

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 111 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.