Unfortunately PHP does not support named parameters, but I've noticed that the PHP syntax allows us something similar:
function list_items( $user, $archived ) { ... }
// This is the default way to call the function.
// It's not very clear what the value and false refer to:
list_items( 10, false );
// Alternative syntax I found which makes this more clear:
list_items( $user = 10, $archived = false );
Both function calls return the same data.
Question
To answer this question: There are no named parameters.
The example in my question simply assigns values to variables and then passes those variables to the function.
list_items( $user = 10, $archived = false );
// is same as this:
$user = 10;
$archived = false;
list_items( $user, $archived );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.