Initially, it somehow worked, but I had to redo the script and now it is many times more complicated, in addition, the transfer of the array to the function is incorrect and I do not receive data in the function.
$cx1 = -1.2; $cx2 = 0; $delta = 0.5; function f_compare($x1, $x2, $type) { global $x1, $x2; print_r ($x1); print_r ($x2); return true; } //Исследующий поиск function cycle($cx1, $cx2, $delta, $type) { global $cx1, $cx2, $delta; $x = array(); $x2 = array(); if ($type==1) {$x[0]=$cx1; $x2[0]=$cx2;} print_r ($x); print_r ($x2); echo f_compare($x,$x2,$type); } cycle($cx1, $cx2, $delta, 1);
The output in the cycle
function will work, but the output in the f_compare
function f_compare
not, why is that?