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

PHP getimagesize() function

<?php
   $image_info = getimagesize("https://www.tutorialspoint.com/images/tp-logo-diamond.png");
   print_r($image_info);
?>

PHP gmp_intval() function

<html>
    <head>
        <title>Online PHP Script Execution</title>
    </head>
    <body>
        <?php
            $var = "180";
            echo intval($var, 8);
        ?>
    </body>
</html>

Numeric Array in PHP

<html>
   <body>
   
      <?php
         /* First method to create array. */
         $numbers = array( 1, 2, 3, 4, 5);
         
         foreach( $numbers as $value ) {
            echo "Value is $value <br />";
         }
         
         /* Second method to create array. */
         $numbers[0] = "one";
         $numbers[1] = "two";
         $numbers[2] = "three";
         $numbers[3] = "four";
         $numbers[4] = "five";
         
         foreach( $numbers as $value ) {
            echo "Value is $value <br />";
         }
         
         
      ?>
      
   </body>
</html>

PHP getimagesize() function

<html>
<head>
<title>Online PHP Script Execution</title>
</head>
<body>
<?php
$image_info = getimagesize("https://www.tutorialspoint.com/images/tp-logo-diamond.png");
print_r($image_info);
?>
</body>
</html>

Check if a string ends with given word in PHP

<html>
<head>
<title>Online PHP Script Execution</title>
</head>
<body>
<?php
function endFunc($str, $lastString) {
   $count = strlen($lastString);
   if ($count == 0) {
      return true;
   }
   return (substr($str, -$count) === $lastString);
}
if(endFunc("pqrstuv","rst"))
   echo "True!";
else
   echo "False!";
?>
</body>
</html>

Check if a string starts with given word in PHP

<html>
<head>
<title>Online PHP Script Execution</title>
</head>
<body>
<?php
function begnWith($str, $begnString) {
   $len = strlen($begnString);
   return (substr($str, 0, $len) === $begnString);
}
if(begnWith("pqrstuvwxyz","p"))
   echo "True! It begins with p!";
else
   echo "False! It isn't beginning with p!";
?>
</body>
</html>

quoted_printable_decode() function in PHP

<html>
<head>
<title>Online PHP Script Execution</title>
</head>
<body>
<?php
$str = 'W=C2=ABlcome to th=C2=AB website!';
// decoding
echo (quoted_printable_decode($str));
?>
</body>
</html>

printable_encode() function in PHP

<html>
<head>
<title>Online PHP Script Execution</title>
</head>
<body>
<?php
$str = 'W«lcome to th« website!';
// displaying
echo (quoted_printable_encode($str));
?>
</body>
</html>

connection_status() function in PHP

<html>
<head>
<title>Online PHP Script Execution</title>
</head>
<body>
<?php
switch (connection_status()) {
case CONNECTION_NORMAL:
  $msg = 'Connection is in a normal state!';
  break;
case CONNECTION_ABORTED:
  $msg = 'Connection aborted!';
  break;
case CONNECTION_TIMEOUT:
  $msg = 'Connection timed out!';
  break;
case (CONNECTION_ABORTED & CONNECTION_TIMEOUT):
  $msg = 'Connection aborted and timed out!';
  break;
default:
  $msg = 'Status is unknown!';
  break;
}
echo $msg;
?>
</body>
</html>

PHP function

<?php
$txt = "W3Schools.com";
echo "I love " . $txt . "!";
?>

<?php
//php two rows of data
$invoices =  array ( array (
                   "invoice_id" => "16" ,
                   "vendor_id" => "97" ,
                   "invoice_number" => "21-4748363" ,
                   "invoice_date"=> "2014-05-03"),

                    array (
                    "invoice_id" => "23" ,
                    "vendor_id" => "97" ,
                    "invoice_number" => "21-4923721" ,
                    "invoice_date"=> "2014-05-13")
                    );
function outputInvoice($invoice)
{
    echo '<tr>';
    echo  '<td>' . $invoice['invoice_id']. '</td>';
    echo '<td>'  . $invoice['vendor_id'] .'</td>';
    echo  '<td>' . $invoice['invoice_number'] .'</td>';
    echo '<td>'  . $invoice['invoice_date'].'</td>';
    echo '</tr>';
}
?>

<!DOCTYPE html>
<html>
<!-- the head section -->
<head>
    <title>Account Payable Database System</title>

  
</head>

<!-- the body section -->
<body>

<div id="wrapper">
    <header><h1> ITS322 Client/Server Database </h1></header>
    <main>
        <h1>Invoices Table </h1>
        <table>
            <tr>
                <th>invoice_id</th>
                <th>vendor id</th>
                <th>invoice_number</th>
                <th>Invoice_date</th>
            </tr>
            <tbody>
            <!-- invoke a php function within a loop -->
             <?php
             foreach ($invoices as $invoice)
             {
                 outputInvoice($invoice);
             }
             ?>
            </tbody>
        </table>
       


    </main>


<footer>Copyright &copy; Irene Tseng 2019</footer>
</div>
</body>
</html>

Previous 1 ... 3 4 5 6 7 8 9 ... 112 Next
Advertisements
Loading...

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