Professional Documents
Culture Documents
Oop Week 2
Oop Week 2
Presented to :
BSIT 1st Year – BLOCK 1, 2, 3, 4, 5, 6, 26 & 27
HERNAN E. TRILLANO, CPCA
Certified Professional Cloud Architect
TABLE OF CONTENTS
06
3
TOPIC #1
PHP COMMENTS
WHAT IS A PHP COMMENT ?
6
SINGLE-LINE PHP COMMENTS
<?php
// This is a single-line comment
11
Print has a return value of 1.
4
12
Echo can take multiple
8 parameters.
13
The PHP echo statement.
<?php
echo "<h2>PHP is Fun!</h2>";
echo "Hello world!<br>";
echo "I'm about to learn PHP!<br>";
echo "This ", "string ", "was ", "made ",
"with multiple parameters.";
?> 14
The PHP print statement.
<?php
print "<h2>PHP is Fun!</h2>";
print "Hello world!<br>";
print "I'm about to learn PHP!";
?>
15
TOPIC #3
PHP DATA TYPES
PHP SUPPORTS THE FOLLOWING DATA TYPES:
STRING 01
INTEGER 02
FLOAT 03
BOOLEAN 04
17
PHP SUPPORTS THE FOLLOWING DATA TYPES:
ARRAY 01
OBJECT 02
NULL 03
RESOURCE 04
18
PHP STRING
Hello world!
Hello world!
19
PHP INTEGER
• An integer data type is a non-decimal number between -2,147,483,648 and
2,147,483,647.
• In the following example $x is an integer. The PHP var_dump() function returns the
data type and value:
int(5985)
20
PHP FLOAT
• A float (floating point number) is a number with a decimal point or
a number in exponential form.
• In the following example $x is a float. The PHP var_dump() function
returns the data type and value:
float(10.365)
21
PHP BOOLEAN
$x = true;
$y = false;
22
PHP ARRAY
23
PHP NULL
• Null is a special data type which can have only one value: NULL.
• A variable of data type NULL is a variable that has no value assigned to it.
Tip: If a variable is created without a value, it is automatically assigned a
value of NULL. Variables can also be emptied by setting the value to NULL:
NULL
24
PHP RESOURCE
25
PHP RESOURCE
26
TOPIC #4
PHP
STRINGS
PHP STRING
28
strlen( )
The PHP strlen( ) function returns the length of a string.
Example:
29
str_word_count( )
Example:
30
strrev( )
Example:
31
strpos( )
• The PHP strpos() function searches for a specific text within a string. If
a match is found, the function returns the character position of the first
match.
Example:
32
str_replace( )
• The PHP str_replace() function replaces some characters with some other
characters in a string.
Example:
33
strtoupper( )
Example:
34
strtolower( )
Example:
35
trim( )
• The trim() removes any whitespace from the beginning or the end:
Example:
36
explode( )
• The PHP explode() function splits a string into an array. The first parameter
of the explode() function represents the "separator".
Example:
37
Character Cases
38
THANK
YOU!!! 39