How to define and call function inside if () condition in PHP

1 Answer

0 votes
$n = true;

if ($n) 
{
  function f()
  {
    echo "call function f()";
  }
}

if ($n) f();


/*
run:

call function f()

*/

 



answered Jun 20, 2016 by avibootz

Related questions

...