Discussion: Problem with references
In the previous quiz, Online PHP Quiz, we tested our experience gained from the course.
2 messages from 2 displayed.
//= Settings::TRACKING_CODE_B ?> //= Settings::TRACKING_CODE ?>
In the previous quiz, Online PHP Quiz, we tested our experience gained from the course.
You must use & in function declaration , like this:
<?php
function add(&$array, $item)
{
$array[] = $item;
}
$a = array(1, 2, 3);
add($a, 4);
print_r($a);
?>
2 messages from 2 displayed.