Site icon DataFlair

PHP strict_types with Examples

Program 1

<html>
<head><title>Demo</title></head>
<body>
    <center>
<?php 

function rev( string $s)
{
    echo strrev($s);
}

  rev('Indore');








// class First
// {
//       public function display()
//       {
//         echo "This is display method of First Class";
//       }
// }

// class Second
// {
//       public function show()
//       {
//         echo "This is show method of Second Class";
//       }
// }

// function displaymethod( First $t)
// {
//      echo "Method call<br>";
//      $t->display();
// }


// $f=new First();
// $s=new Second();
// displaymethod($s);








    // function display( array $citys)
    // {
    //      echo "This are citys Name: <br>";
    //       foreach( $citys as $name)
    //       {
    //            echo $name."<br>";
    //       }
    // }

    //    $arr=['Indore','Bhopal','Pune','Delhi']; 
    //   display($arr);
    
    
    // function area( float $r)
    // {
    //        $a=3.14*$r*$r;
    //        echo "Area is: ".$a;
    // }
   
    //  area("Hello");








    //    function display(int $n)
    //    {
    //          echo "Hello this is a Code<br>";
    //          echo "Hello this is a Code<br>";
    //          echo "Hello this is a Code<br>";
    //          echo "Hello this is a Code<br>";
    //           echo $n*10;
    //           echo "<br>";
    //           echo $n-10;
    //    }
    
       //display("indore");
?>
</center>
</body>
</html>

 

Exit mobile version