As a general rule, don't do this. It's not very good and looks terrible, but this is what you need.
<?php
$name = null;
$family = null;
$old = null;
function show()
{
global $name, $family, $old;
$name = "john";
$family = "cina";
$old = "45";
}
show();
echo "your name is $name ".PHP_EOL;
echo "your family is $family ".PHP_EOL;
echo "your old is $old ".PHP_EOL;
I will recommend an alternative way of writing this (one of many). You can check other answers for different ways.
class Singleton {
public static $name;
public static $family;
public static $old;
}
function show()
{
Singleton::$name = "john";
Singleton::$family = "cina";
Singleton::$old = "45";
}
show();
echo "your name is ".Singleton::$name;//in another line
echo "your family is ".Singleton::$family;//in another line
echo "your old is ".Singleton::$old;//in another line