note 67611 deleted from function.sprintf by bjori

From: Date: Thu, 08 Jun 2006 23:58:01 +0000
Subject: note 67611 deleted from function.sprintf by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-113969@lists.php.net to get a copy of this message
Note Submitter: toolbag at gmail dot com Reason: in docs ---- The example of using argument swapping, or re-using a single argument twice is incorrect. There should be a backslash before the $ sign, otherwise PHP attempts to interpret as a variable. E.g. $foo = sprintf(" ... LIKE '%%%1$s%%' OR foo LIKE '%%%2$s%%'", $myName); should be ... "LIKE '%%%1\$s%%'". Similary for the second definition. Without the backslash, PHP tries to look for the variable "$s" which doesnt exist (or maybe it does in your program, which would create a different error).

« previous php.notes (#113969) next »