Anonymous Function in PHP

Program 1

<html>
    <head><title>PHP For Loops</title>
    <body>
     <center>
  
<?php
     // Function as variable
      function myFunction($name)
      {
        echo "Hello ".$name." Data Flair Free Course";
      }

    // Calling
    //myFunction();
    $display="myFunction";
    $display("Vivek ");
?>
</center>
</body>
</html>

program 2

<html>
    <head><title>PHP For Loops</title>
    <body>
     <center>
  
<?php

    // $myDisplay=function($name)
    // {
    //     echo "Hello Friend How are you".$name;
    // }; 

    // $myDisplay("Virat Kohli")

    // // n power p n
?>

</center>
</body>
</html>
courses

Leave a Reply

Your email address will not be published. Required fields are marked *