On Wednesday 06 April 2005 18:05, Brent Baisley typed:
> You want to have sprintf look at the contents of the variable instead
> of the variable itself. Anytime you want to do something like this you
> use the eval() function to evaluate the contents of the variable.
Woot!
$begin_string = 'htmlen
On Wed, April 6, 2005 4:23 am, Duncan Hill said:
> I have a snippet of code that looks something like:
> if (is_array($p_sub_values)) {
> foreach ($p_sub_values as $i => $v) {
> $p_sub_values_str[$i] = "'$v'";
> }
> $s = join(',', $p_sub_values_str);
> $r =
Making life groovy has been difficult since the 60's.
You want to have sprintf look at the contents of the variable instead
of the variable itself. Anytime you want to do something like this you
use the eval() function to evaluate the contents of the variable.
On Apr 6, 2005, at 12:46 PM, Duncan
On Wednesday 06 April 2005 16:40, Brent Baisley wrote:
> For one, you are missing a right parenthesis ) in all of your examples.
> htmlentities( sprintf( $tmp[0], $s, ENT_QUOTES )
Meh, syntax blip from the cut and paste.
> Second, the string you are trying to format only has one variable
> argum
For one, you are missing a right parenthesis ) in all of your examples.
htmlentities( sprintf( $tmp[0], $s, ENT_QUOTES )
Second, the string you are trying to format only has one variable
argument: $s.
Fred likes %1$s on his %2$s
You have it numbered for ordering, but you are still ordering one
I have a snippet of code that looks something like:
if (is_array($p_sub_values)) {
foreach ($p_sub_values as $i => $v) {
$p_sub_values_str[$i] = "'$v'";
}
$s = join(',', $p_sub_values_str);
$r = htmlentities(sprintf($tmp[0], $s, ENT_QUOTES);
}
$tmp[0] in th
6 matches
Mail list logo