I'm trying to return multiple values from a function. I understand I need to return these as an array.
The function returns two values like this (variables, created in the function):
$value1 = mypage.php;
$value2 = '1';
return array($value1, $value2);
I attempt to access it like this:
<?php
echo "<a href=\"" . MyFunction()[0] . "?value2=" . MyFunction()[1] . "\">Link</a>";
?>
But I keep getting a syntax error for missing comma or semicolor. When I remove the [0] and [1] I don't get an error but of course the inserted value is simply "Array" (since an array is being returned).
Is this array multidimensional? How do I get at its contents?
Thanks!