php function return multiple values
// Function to swap two numbers
function swap( $x, $y ) {
return array( $y, $x );
}
php function return multiple values
// Function to swap two numbers
function swap( $x, $y ) {
return array( $y, $x );
}
php return multiple variables from function
<?php
function small_numbers()
{
return [0, 1, 2];
}
// Array destructuring will collect each member of the array individually
[$zero, $one, $two] = small_numbers();
// Prior to 7.1.0, the only equivalent alternative is using list() construct
list($zero, $one, $two) = small_numbers();
?>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us