Doc #80622 [Nab]: Optional argument brackets

From: Date: Thu, 14 Jan 2021 04:57:18 +0000
Subject: Doc #80622 [Nab]: Optional argument brackets
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18387@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80622&edit=1

 ID:                 80622
 User updated by:    grzesiek at gbankowski dot pl
 Reported by:        grzesiek at gbankowski dot pl
 Summary:            Optional argument brackets
 Status:             Not a bug
 Type:               Documentation Problem
 Package:            Documentation problem
 Operating System:   irrelevant
 PHP Version:        Irrelevant
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

I understand. I'm preparing for Zend Certified PHP Engineer exam, which bases on PHP 7.1. It is
possible to read or download old documentation for this version? Thank You very much in advance.


Previous Comments:
------------------------------------------------------------------------
[2021-01-13 16:59:25] cmb@php.net

This argument is no longer optional as of PHP 8.0.0[1].

[1] <https://www.php.net/manual/en/function.crypt.php#refsect1-function.crypt-changelog>

------------------------------------------------------------------------
[2021-01-13 16:48:34] grzesiek at gbankowski dot pl

Let's look at crypt function:

crypt ( string $string , string $salt ) : string # current documentation

and look at previous documentation:

crypt ( string $str [, string $salt ] ) : string # in this case we know that second argument is
optional. In current version we don't know.

------------------------------------------------------------------------
[2021-01-13 13:54:18] cmb@php.net

Actually, this case is not related to the mentioned PR, but rather
because variable-length argument lists[1] can be empty.

[1] <https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list>

------------------------------------------------------------------------
[2021-01-13 13:42:05] cmb@php.net

This has been done to match PHP's syntax for user defined
functions more closely[1].

[1] <https://github.com/php/phd/pull/37Y>

------------------------------------------------------------------------
[2021-01-13 13:35:17] grzesiek at gbankowski dot pl

Description:
------------
Dear PHP webmasters,

I'm writting to inform that, in all funcions disappeared brackets [] for optional arguments.
Why?

sscanf ( string $string , string $format , mixed &...$vars ) : array|int|null

$vars is optional, but where are brackets?

Best regards
Grzegorz

Test script:
---------------





------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80622&edit=1


Thread (9 messages)

« previous php.doc.bugs (#18387) next »