<?php $image_info = getimagesize("https://www.tutorialspoint.com/images/tp-logo-diamond.png"); print_r($image_info); ?>
<html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php $var = "180"; echo intval($var, 8); ?> </body> </html>
<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>
<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>
<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>
<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>
<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>
<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>
<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 $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 © Irene Tseng 2019</footer> </div> </body> </html>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more