note 126889 added to function.sprintf

From: Date: Tue, 01 Mar 2022 06:35:55 +0000
Subject: note 126889 added to function.sprintf
Groups: php.notes 
Request: Send a blank email to php-notes+get-217669@lists.php.net to get a copy of this message
If the format string is enclosed in double-quotes (""), you need to escape the dollar sign after argnum with a backslash character (\), like this %1\$s, so that the PHP doesn't try to interpret them as variable. Using a backslash like this is called an escape sequence. <?php // Sample string $number = 499; $format = "The number without decimal points: %1\$d, and the number with two decimal points: %1\$.2f"; // Formatting and print the string printf($format, $number); ?> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.135 (proxied: 78.94.46.154) ---- Manual Page -- https://php.net/manual/en/function.sprintf.php Edit -- https://main.php.net/note/edit/126889 Del: integrated -- https://main.php.net/note/delete/126889/integrated Del: useless -- https://main.php.net/note/delete/126889/useless Del: bad code -- https://main.php.net/note/delete/126889/bad+code Del: spam -- https://main.php.net/note/delete/126889/spam Del: non-english -- https://main.php.net/note/delete/126889/non-english Del: in docs -- https://main.php.net/note/delete/126889/in+docs Del: other reasons-- https://main.php.net/note/delete/126889 Reject -- https://main.php.net/note/reject/126889 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#217669) next »