Tools, FAQ, Tutorials:
Returning an Array from a Function in PHP
How To Return an Array from a Function? in PHP?
✍: FYIcenter.com
You can return an array variable like a normal variable using the return statement. No special syntax needed. Here is a PHP script on how to return an array from a function:
<?php function powerBall() { $array = array(rand(1,55), rand(1,55), rand(1,55), rand(1,55), rand(1,55), rand(1,42)); return $array; } $numbers = powerBall(); print("Lucky numbers: ".join(",",$numbers)."\n"); ?>
This script will print:
Lucky numbers: 35,24,15,7,26,15
If you like those nummers, take them to buy a PowerBall ticket.
Â
⇒Creating Your Own Functions in PHP
⇒⇒PHP Tutorials
2016-12-18, 1169👍, 0💬
Popular Posts:
How To Remove Slashes on Submitted Input Values in PHP? By default, when input values are submitted ...
How to use "{{...}}" Liquid Codes in "set-body" Policy Statement? The "{{...}}" Liquid Codes in "set...
How to add request URL Template Parameters to my Azure API operation 2017 version to make it more us...
How to use the "rewrite-uri" Policy Statement for an Azure API service operation? The "rewrite-uri" ...
How to access URL template parameters from "context.Request.Matched Parameters"object in Azure API P...