php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #32617 Argument swapping example contains bogus slashes
Submitted: 2005-04-07 09:45 UTC Modified: 2005-04-07 10:11 UTC
From: tommy at apt dot no Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tommy at apt dot no
New email:
PHP Version: OS:

 

 [2005-04-07 09:45 UTC] tommy at apt dot no
Description:
------------
http://se.php.net/sprintf#AEN144043

The slashes infront of the $ shouldn't as far as I can see, be there:

Example 3. Argument swapping
<?php
$format = "The %2\$s contains %1\$d monkeys";
printf($format, $num, $location);
?> 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-07 10:03 UTC] dmytton@php.net
This is not a bug. The slashes are required because you have the integer specifying the order in front of the $.
 [2005-04-07 10:11 UTC] tommy at apt dot no
Sorry, my mistake. 
When using " as string delimiter, they should obviously be there, as in the example. But, if using ' as string delimiter, they shouldn't be there, but this isn't really relevant for the example.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 17:01:35 2025 UTC