functions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nincha
Forum Contributor
Posts: 191
Joined: Fri Mar 28, 2003 12:30 pm
Location: CA, USA

functions

Post by nincha »

any one got any ideas of creating a function that returns multiple variables/values??
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Code: Select all

function foo(){
    $val1 = 'hello';
    $val2 = 'goodbye';
    return array($val1, $val2);
}
list($val1, $val2) = foo();
Post Reply