Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2005051

Re: [PHP] Generating a php file From: Dan Rossi (php <email protected>)
Date: 05/11/05

On 12/05/2005, at 6:03 AM, Rory Browne wrote:

> You can start by clarifying. I had to read your message three times
> before I got a vague understanding.
>
> What I'm hearing is that you want to put something like
> <?php $msg = get_message(); ?> into a string? You are having
> difficulty doing this because you are finding that your string
> contains the value of $msg, instead of a doller sign, followed by
> 'msg'?
>
> If so, then you can:
>
> Use Single Quotes:
> $code = '<?php $msg = get_message(); ?>'
>
> or Escape your $-signs, by placing a backslash(\) in front of the
> $-sign
> $code = "<?php \$msg = get_message(); ?>";
>
>

I've had a habit of this of late ! Let me clarify for you then ;)

I have a php file say

<?
$query = $_SERVER['QUERY_STRING'];
$somevar = 'somevalue';
?>

i need to dynamically generate some values in the script and output a
new file to download from it ie

<?
$query = $_SERVER['QUERY_STRING'];
$somevar = $this->somevalue;
?>

becomes

<?
$query = $_SERVER['QUERY_STRING'];
$somevar = 'somevalue';
?>

where $this->somevalue is from my generator class ;)

However if I do

$buffer = "<?
$query = $_SERVER['QUERY_STRING'];
$somevar = 'somevalue';
?>";

I get all sorts of errors around $_SERVER.

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