PHP 6-10 Lab Program
PHP 6-10 Lab Program
Create a script using a for loop to add all the integers between 0
and 30 and display the total.
<?php
$sum = 0;
$sum += $x;
?>
7. Write a PHP script using nested for loop that creates a chess board.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<?php
8. Write a PHP function that checks if a string is all lower case.
if($total % 2 == 0)
else
?>
</table>
</body>
</html>
<?php
function is_str_lowercase($str1)
// Test the function with sample strings and display the results
?>
9. Write a PHP script to calculate the difference between two dates.
<?php
// Start date
$sdate = "1981-11-04";
// End date
$edate = "2013-09-04";
// Calculate the difference between the end date and the start date in seconds
printf("\n");
?>
10. Write a PHP script to display time in a specified time zone
<?php
date_default_timezone_set('Asia/Kolkata');
$timezone_object = date_default_timezone_get();
if ($timezone_object) {
echo date_default_timezone_get() . ' => ' . date('e') . ' => ' . date('T');
echo $myDate;
?>