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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 01:01:28 2024 UTC