Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Multidimensional Arrays in PHP

<html>
   <body>
      
      <?php
         $marks = array( 
            "mohammad" => array (
               "physics" => 35,
               "maths" => 30,	
               "chemistry" => 39
            ),
            
            "qadir" => array (
               "physics" => 30,
               "maths" => 32,
               "chemistry" => 29
            ),
            
            "zara" => array (
               "physics" => array(
                   "physics_1"=>75,
                    "physics_2" =>34
                   ),
               "maths" => 22,
               "chemistry" => 39
            )
         );
         
         /* Accessing multi-dimensional array values */
         echo "Marks for zara in physics : " ;
         echo $marks['zara']['physics']['physics_1'] . "<br />"; 
         
         echo "Marks for qadir in maths : ";
         echo $marks['qadir']['maths'] . "<br />"; 
         
         echo "Marks for zara in chemistry : " ;
         echo $marks['zara']['chemistry'] . "<br />"; 
      ?>
   
   </body>
</html>

Associative Arrays in PHP

<html>
   <body>
      
      <?php
         $a= array(1,2,3);
         foreach($a as $value)
         {
             print("$value<br>");
         }
         
         $b=array("al"=> 12,"bl" =>15,"cl" =>12);
         foreach($b as $value)
         {
             if($b['al']==$b['cl'])
             {
                 print("Array same");
                 break;
             }
             else{
                 print("array not matched");
             }
         }
      ?>
   
   </body>
</html>

larger number

<html>
   <body>
      <?php
         echo "this will find the largest number from 3 number<br>";
         $a=7;
         $b=5;
         $c=6;
         if($a>=$b && $a>=$c)
              echo "a is the bigger number";
         if($b>=$a && $b>=$c)
              echo "b is the bigger number";
         if($c>=$a && $c>=$b)
             echo "c is the bigger number";
      ?>
   </body>
</html>

74447

<?php
   $copy_date = "API KEY 1478";
   $copy_date = preg_replace("([0-9]+)", "123", $copy_date);
   
   print $copy_date;
?>

Here Document

<?php
 
   $A=10;
   $C=20;
   
   $c=+$A;
   
   echo "$c";
   
   


?>

Running PHP Script

<html>
    
    <title> Incidnet | ServiceNow</title>
    
    <body>
        
      <?php
      
    $abrar = 6;
    $sheriff = 9;
    $sum = $abrar + $sheriff;
    
    echo " $abrar<br>";
    echo " $sheriff<br>";
    echo " total= $sum";
    
      ?>
        
        
        
    </body>
    
</html>

HELLO

<html>
   <body>
      
      <?php
         $capital = 67;
         print("Variable capital is $capital<br>");
         print("Variable CaPiTaL is $CaPiTaL<br>");
      ?>
      
   </body>
</html>

PHP is case sensitive

<html>
   <body>
      
      <?php
         $capital = 67;
         $CaPiTaL = 66;
         print("Variable capital is $capital<br>");
         print("Variable CaPiTaL is $CaPiTaL<br>");
         print "this
         is 
         multiline";
      ?>
      
   </body>
</html>

Black

<?php
   $channel = array('title' => "What's For Dinner",
      'link' => 'https://menu.example.com/',
      'description' => 'Choose what to eat tonight.');
   
   print "<channel>\n";
   
   foreach ($channel as $element => $content) {
      print " <$element>";
      print htmlentities($content);
      print "</$element>\n";
   }
   
   print "</channel>";
?>

emre

<html>
   <body>
      
      <?php
         $gün = date("D");
         
         switch ($gün){
            case "Mon":
               echo "Bugün Pazartesi";
               break;
            
            case "Tue":
               echo "Bugün Salı";
               break;
            
            case "Wed":
               echo "Bugün Çarşamba";
               break;
            
            case "Thu":
               echo "Bugün Perşembe";
               break;
            
            case "Fri":
               echo "Bugün Cuma";
               break;
            
            case "Sat":
               echo "Bugün Cumartesi";
               break;
            
            case "Sun":
               echo "Bugün Pazar";
               break;
            
            default:
               echo "Geçersiz Gün";
         }
      ?>
      
   </body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.