WBDV Midterm Reviewer
WBDV Midterm Reviewer
FORM HANDLING
FORM HANDLING
GET VS POST
FORM HANDLING
RADIO BUTTONS RETURN TYPE ARGUMENTS
The gender fields are radio buttons and the HTML code PHP 7 also supports Type Declarations for
looks like this: the return statement. Like with the type declaration for
function arguments, by enabling the strict requirement,
it will throw a "Fatal Error" on a type mismatch.
To declare a type for the function return, add a colon
( : ) and the type right before the opening curly
( { )bracket when declaring the function.
USER DEFINE FUNCTION In the following example we specify the return type for
the function:
PHP FUNCTION
Syntax The date() function formats a local date and time, and
returns the formatted date string
PARAMETER VALUES
Date_diff() function
mktime() function
<?php
// Prints: October 3, 1975 was on a Friday
echo "Oct 3, 1975 was on a ".date("l",
mktime(0,0,0,10,3,1975));
?>
strftime() function
<?php
echo(strftime("%B %d %Y, %X %Z",mktime(20,0,0,12,31,
98))."<br>");
setlocale(LC_ALL,"hu_HU.UTF8");
echo(strftime("%Y. %B %d. %A. %X %Z"));
?>
localtime() function
<?php
print_r(localtime());
echo "<br><br>";
print_r(localtime(time(),true));
?>
string() function
The PHP string functions are part of the PHP core. No
installation is required to use these functions
If you have a list of items (a list of courses, for example),
storing the course in single variables could look like
this:
$courses1="BSIT";$courses2="BSHRM";$courses3="ACT";
WHAT IS ARRAY?
ARRAY
CREATING AN ARRAY
array();
INDEX ARRAY
$courses=array("BSIT","BSHRM","ACT");
Example
<?php$age=array("John"=>"25","Fred"=>"27","Max"=>"63
");echo "Peter is " . $age['Peter'] . " years
old.";?>
<?php$age=array("John"=>"25","Fred"=>"27","Max"=>"63
");foreach($age as $x=>$x_value)
{
echo "Key=" . $x . ", Value=" . $x_value;
echo "<br>";
}?>
MULTIDIMENSIONAL ARRAY
$c=array_combine($fname,$age);
print_r($c);
?>
<?php
$grade=array(86,78,66,75,98);
rsort($grade);
?>
<?php
$score=array(“Math"=>“55",“English"=>“100",“FIL"=>“6
5");
asort($score);
?>
<?php
$score=array(“Math"=>“55",“English"=>“100",“FIL"=>“6
5");
ksort($score);
?>
<?php
$score=array(“Math"=>“55",“English"=>“100",“FIL"=>“6
5");
arsort($score);
?>