undefined variable php function code example Example: undefined variable inside function php $myId = 0; function run(){ global $myId; echo $myId; }