The strings $test1, $test2, $test3, and $test4 are created in the function test() . How can I print her?
My code:
conf.php
<?php
function test(){
$test1 = 'test1 string';
$test2 = 'test2 string';
$test3 = 'test3 string';
$test4 = 'test4 string';
}
?>
test.php
<?php
require_once("conf.php");
test();
echo $test1;
echo $test2;
echo $test3;
echo $test4;
?>
Why code not worked?
Why weren’t $test1, $test2, $test3, and $test4 printed.
P.S.: preferably without globals parameters.
for the multiple entities you have to use arrays.
So, here is a general purpose solution.
For the certain answer we need a certain question though