Fri, 17 May 2024


How to pass an argument to a function by reference in PHP?

By: Peter, NetArt Media
Wed, 9 February 2022

<?php
function SomeFunction(& $SomeArgument)
{
$SomeArgument=$SomeArgument+5;
}

$TestVar=10;
SomeFunction($TestVar);

echo $TestVar; // will print 15 !!

?>


Category: PHP Examples
Share this post:



See All Scripts






Subscribe for our newsletter

Receive the latest blog posts direct in your mailbox