Exemple #1
0
<!DOCTYPE html>
<html>
<head>
<title>Is String Lowercase?</title>
</head>
<body>
<h2>Problem: Input string, then chekc to see if it is lowercase.</h2>
  <form method="POST">
    <input type="text" placeholder="String" name="string" />
      <input type="submit"/>
    </form>
<?php 
require_once 'mylib.php';
check_LowerCase();
?>

</body>
</html>
Exemple #2
0
//Write a function to reverse a string.
function Rstring($string)
{
    return strrev($string);
}
//Write a function that checks if a string is all lower case.
function check_LowerCase($string)
{
    $lowerCase = strtolower($string);
    if ($string === $lowerCase) {
        echo $string . " is all lowercased";
    } else {
        echo $string . " not all lowercased.";
    }
}
echo "<br>" . check_LowerCase($string);
//Write a function that turns a unix timestamp into a readable date and time.
function dateTime()
{
    return "Date: " . gmDate("m-d-Y") . "  |  Time: " . gmDate("H:i");
}
/*Write a function that converts and returns just the file name from a URL
example: ‘http://www.weblab.com/weblab/index.php
result: ‘index.php’*/
/*
function baseName() {
  echo $_SERVER['QUERY_STRING'];
}
*/
/*Write a function that returns the last sentence of a string.
example: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.’