Skip to content

printf 系のフォーマット文字列で、引数の位置指定書式の解説が誤っていたのを修正 - #2

Closed
sj-i wants to merge 1 commit into
php:masterfrom
sj-i:fix-printf-positional-parameter
Closed

sj-i wants to merge 1 commit into
php:masterfrom
sj-i:fix-printf-positional-parameter

Conversation

@mumumu mumumu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以下の実行結果から、明確に誤訳ですね。指摘ありがとうございます。

<?php

$num = 1;
$location = "tokyo";
$format = 'The %2$s contains %1$d monkeys';

// The tokyo contains 1 monkeys
echo sprintf($format, $num, $location);

@php-pulls php-pulls closed this in 6e85839 Jan 14, 2021
php-pulls pushed a commit that referenced this pull request Mar 19, 2021
The documented parameters differ from the names exposed in reflection/source code. Now that named parameters are supported in PHP 8, this discrepancy is confusing and impactful.

```
 $ php --rf fgetcsv
Function [ <internal:standard> function fgetcsv ] {

  - Parameters [5] {
    Parameter #0 [ <required> $stream ]
    Parameter #1 [ <optional> ?int $length = null ]
    Parameter #2 [ <optional> string $separator = "," ]
    Parameter #3 [ <optional> string $enclosure = "\"" ]
    Parameter #4 [ <optional> string $escape = "\\" ]
  }
  - Return [ array|false ]
}
```

Closes GH-493.
brcontainer added a commit to brcontainer/doc-ja that referenced this pull request Sep 8, 2026
Same as: php/doc-en#5842

Incorrect:

```php
case 0x8000: // regular
    $info = 'r';
```
KentarouTakeda pushed a commit that referenced this pull request Sep 8, 2026
* Fixes Example #2 using fileperms

Same as: php/doc-en#5842

Incorrect:

```php
case 0x8000: // regular
    $info = 'r';
```

* EN-Revision
KentarouTakeda pushed a commit that referenced this pull request Sep 8, 2026
* Fixes Example #2 using fileperms

Same as: php/doc-en#5842

Incorrect:

```php
case 0x8000: // regular
    $info = 'r';
```

* EN-Revision

* Change file type representation from 'r' to '-'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants