[EMAIL PROTECTED] wrote:
Hi, is there a function that can parse variables within a string?
For example:
$good_day = 'The';
$fr['iop'] = "y're crazy!";
$new = '$good_day$fr['iop']';
echo TheFunctionIRequest($new); // They're crazy!
Thanks!
One thing to add to what everybody else is saying,
anchanworld.com/
> http://webdirectory.sanchanworld.com - Submit your website URL
> http://webhosting.sanchanworld.com - Choose your best web hosting plan
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 15, 2007 12:41 PM
ng plan
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 15, 2007 12:41 PM
To: Chris
Cc: php-general@lists.php.net
Subject: Re: [PHP] Parsing Variables Inside a String
I need to get the variable names from a database.
On 8/15/07, Chris <[
$new = '$good_day$fr['iop']';
This will give you error...
Instead if you try in this way as follows
$new = "$good_day$fr['iop']"; or
$new = $good_day.$fr['iop'];
It will include the "They're carzy!" in the $new variable..
Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sa
I need to get the variable names from a database.
On 8/15/07, Chris <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Hi, is there a function that can parse variables within a string?
> >
> > For example:
> >
> > $good_day = 'The';
> > $fr['iop'] = "y're crazy!";
> >
> > $new = '$good_day$
[EMAIL PROTECTED] wrote:
Hi, is there a function that can parse variables within a string?
For example:
$good_day = 'The';
$fr['iop'] = "y're crazy!";
$new = '$good_day$fr['iop']';
echo TheFunctionIRequest($new); // They're crazy!
Well this:
echo $good_day . $fr['iop'];
will do what you sh
Dear Paul,
this is exactly the problem: the string including the dollar sign comes
from the database.
The problem I have is that the echo statement parses the $bar reference,
but not the $foo reference within it.
So
echo $bar
generates
Hello $foo
which is better than
$bar
but d
Use double quotes/
On 07/04/06, David Clough <[EMAIL PROTECTED]> wrote:
>
> I've been bashing my head against the wall on this, and would be glad of
> help to stop.
>
> I have a variable containing a string that contains the names of
> variables, and want to output the variable with the variables
I wrote:
You need to EVALUATE the string coming from the database:
Assuming that $sDataField contains the string 'Hello $foo':
$foo = "cat";
$sText = eval($sDataField);
RESULT: $sText = "Hello cat"
http://php.net/eval
I was assuming that you meant that the string "Hello $fo
At 09:37 AM 4/7/2006, David Clough wrote:
I have a variable containing a string that contains the names of
variables, and want to output the variable with the variables it
contains evaluated. E.g.
$foo contains 'cat'
$bar contains 'Hello $foo'
and I want to output $bar as
Hello cat
T
vid Clough; php-general@lists.php.net
Subject: RE: [PHP] Parsing variables within string variables
[snip]
I have a variable containing a string that contains the names of
variables, and want to output the variable with the variables it
contains evaluated. E.g.
$foo contains 'cat'
[snip]
I have a variable containing a string that contains the names of
variables, and want to output the variable with the variables it
contains evaluated. E.g.
$foo contains 'cat'
$bar contains 'Hello $foo'
and I want to output $bar as
Hello cat
The problem is that if I use
David,
Is this what you're looking for?
$bar = 'Hello '.$bar
HTH,
Kevin
-Original Message-
From: David Clough [mailto:[EMAIL PROTECTED]
Sent: 07 April 2006 17:37
To: php-general@lists.php.net
Subject: [PHP] Parsing variables within string variables
I've been bashing my head against
Yes when I checked out the manual page for eval() it did occur to me that it
did open up significant potential for abuse. As it happens I am passing
user supplied values into these variables, but I validate all my input
anyway to prevent people from modifying my queries etc.. I have observed
that
On 30 January 2004 12:35, jimbo wrote:
> Great - thanks v. much Mike. I don't know why there was no mention of
> eval() in the section of the manual on Variable Parsing.
Possibly because they didn't want to get into the security issues involved.
It sounds like you're ok there, as you only intend
Great - thanks v. much Mike. I don't know why there was no mention of
eval() in the section of the manual on Variable Parsing.
James
--
www.jholt.co.uk : affordable business website solutions
www.htpshareware.com : software for the disorga
On 29 January 2004 14:56, jimbo wrote:
> Hi,
>
> I have a query regarding variable parsing.
>
> I have some text in a MySQL database in which I have included some
> variable names. Eg (but w/o quotes): "thankyou $name for registering
> on our web site".
>
> I query and use mysql_fetch_array to
* Thus wrote Jason Williard ([EMAIL PROTECTED]):
> I would like to create a script that reads a file name that follows a
> specific format and have it parsed into 2 variables. The format is as
> follows:
>
> cli_info-ACCOUNT-USERNAME.dat
>
> The two variables that I would like to get out of this
> I send hidden variables from a form to a php. In the php
> I have the following code to convert the global vars sent:
>
> If (isset($_GET['foo']))
> $foo = $_GET['foo']
> else
> $foo = 0;
>
> But this only works using the "GET" method!
If you're sending the
You can use $_POST in a similar fashion to retrieve values from form
that have been posted with the POST method.
Also, you can use $_REQUEST to catch both at the same time. In this
case, you may have a problem if the same variable is passed through both
GET and POST, in that one will override th
*oops!*
Sorry about the double ampersands...
newpage.php?variable1=value1&variable2=value2...
__John Monfort_
_+---+_
P E P I E D E S I G N S
www.pepiedesigns.com
"The world is waiting, are you ready?"
-+_
Sending variables in url:
newpage.php?variable1=value&&variable2=value2&&variable3=value
__John Monfort_
_+---+_
P E P I E D E S I G N S
www.pepiedesigns.com
"The world is waiting, are you ready?"
-+_
here's a tip:
page1:
page2:
try to guess the answer :-)
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-Original Message-
From: Tarrant Costelloe [mailto:[EMAIL PROTECTED]]
Sent: Thursday,
23 matches
Mail list logo