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

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

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