psykykkat Posted July 13, 2007 Share Posted July 13, 2007 Hello Everyone! I feel like I'm going out of my mind. I've been through the help files here, googled my heart out on every possible word convention I could think of and so I'm left asking for help from the public. I'm running PHP 5 on a Windows Server. My problem is as follows. I am using PHP to telnet into and run commands on a UNIX system to look for files and parse logs. However, the latest roadblock is the need to pass a complete "for n in" loop including a UNIX designated variable like "$n". Since PHP variables are also denoted by the "$" the script merely passes blank information, killing the loop. All PHP variables are passing correct information, I just need the "$n" to appear on the UNIX system and not Well, I don't consider myself an expert in any sense of the word, but I can't seem to find an answer to this anywhere. Any help would be appriciated! Thanks! Kat p.s. Knowing my luck it's a simple answer and I'm looking over it. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted July 13, 2007 Share Posted July 13, 2007 enclose the statement you are passing to the unix system in single quotes. Statements in single quotes are taken literally by php. Php will substitute values for variables when they are inside statements wrapped in double quotes. $x = "some text"; echo "x = $x"; //prints x = some text echo 'x = $x"; //prints x = $x Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.