Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 200003

[PHP3] Variable substitution in sprintf() format string ?! From: Andreas Jung (ajung <email protected>)
Date: 03/31/00

Take a look the following code. I am trying to use a variable
as format string for sprintf(). The string itsself contains
some other variable that should be replaced within the sprintf()
call however I are not replaced. I tried a lot with escaping $
and quoting but without result. Maybe someone can help.

<?
    $row = Array();
    $row["x"] = "teststring: ";
    $dummy = "also a test";

    $s = '$row["x"]/%s';
    $s1 = '$dummy/%s';

    echo sprintf("$s\n",'blabla');
    echo sprintf("$s1\n",'blabla');
?>

Thanks,
Andreas

-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>