You missed calling your function and also remove the protected
keyword.
Try this way
<?php
$tmp = "testing";
testFunction(); // you missed this
function testFunction(){ //removed protected
global $tmp;
echo($tmp);
}
Same code but using $GLOBALS
, gets you the same output.
<?php
$tmp = "testing";
testFunction(); // you missed this
function testFunction(){ //removed protected
echo $GLOBALS['tmp'];
}