Skillset
Infinite Education
Play & Learn
Prices
Skillset
Upgrade
Login
Skillset
skillest php
by
hussam aldaj
Subject:
skillest php
Read more
0%
Your learning progress
0/185
Legend
Must-have
Nice to have
Optional
Recommended option
Must-have
Nice to have
Optional
Recommended option
basic Structures PHP
Printing
print_r($arr);
echo($var);
variable checking
var_dump(isset($fruits[2]));
is_double(3.45);
is_numeric("3.45");
is_integer(3.4);
is_int(3.4);
is_float(1.25);
Control Structures PHP
selection structure if else
Nested ternary
$age < 22 ? ($age < 16 ? 'Too young' : 'Young') : 'Old';
Ternary if
$age < 22 ? 'Young' : 'Old';
iterative structures foreach
continue
selection structure switch
break
iterative structures while
iterative structures for
selection structure if
iterative structures do while
Operators PHP
Declaring numbers
Arithmetic operations
comparison operators
== , === , <> , >= , <= , > , < , ?
Decrement operator
--$n2;
$n2--;
Increment operator
$n1++;
++$n1;
Assignment with math operators
$n2 = $n2 * 3;
$n1 *= 3;
logical operators
&& , | |, !
basic for coding
Setup Mac Environment
Setup Windows Environment
Comment
/* Multiline comment with some long text */
# Another single line comment
// Single line comment
Arithmetic conversions
$strNumber = '12.34';
$number = intval($strNumber);
$number = floatval($strNumber);
$number = (float)$strNumber;
$number = (int)$strNumber;
PHP Variables
Float
$height = 1.85;
Integer
$age = 28;
Null
$salary = null;
Boolean (bool)
$isMale = true;
String (string)
Declaring string
$name = "Zura";
String functions
strlen(string $string)
explode(string $separator, string $string, int $limit = PHP_INT_MAX)
implode(string $separator, array $array)
md5(string $string, bool $binary = false)
md5_file(string $filename, bool $binary = false)
str_split(string $string, int $length = 1)
trim(string $string, string $characters = " \n\r\t\v\x00")
str_word_count(string $string, int $format = 0, ?string $characters = null)
Array
Declaring array
$arr=array("var1","var2","var3",...)
associative array
$person = [ 'name' => 'Brad', 'surname' => 'Traversy', 'age' => 30, 'hobbies' => ['Tennis', 'Video Games'], ];
$arr=[var1,var2,var3,...]
operator array
Get element by index
$person['name']
Add element at the beginning of the array
array_unshift($fruits, 'Apple');
Remove element from the beginning of the array
array_shift($fruits);
Search element index in the array
array_search("Peach", $fruits,true)
Remove element
array_pop($fruits);
Print the length
count($arr)
Sorting associative arrays by values, by keys
ksort, krsort, asort, arsort
ksort($person);
Print the values of the array
array_values($person)
Merge two arrays
array_merge($fruits, $vegetables)
Print the keys of the array
array_keys($person)
Sorting of array
sort($fruits);
Add element
array_push($fruits, 'Foo');
Set element by index
$person['channel'] = 'TraversyMedia';
function php
User-defined functions
Function arguments
Returning values
Anonymous functions
Arrow Functions
Constants
define
const
PHP: OOP basics
Classes variables
const
public
private
protected
Constructor
__construct($variable)
Inheritance
extends
Magic Methods
__namemethods
Interface
Access statically
PHP: Anonymous classes
Keyword
Final
$this
getter && setter
Scope Resolution Operator (::)
Magic constants
__FILE__
__DIR__
__line__
Read files and folders inside directory
Exception in PHP 8.0
Basic error handling
Namespaces
Predefined Variables
$GLOBALS
$_SERVER
$_GET
$_POST
$_FILES
$_REQUEST
$_SESSION
$_ENV
$_COOKIE
$php_errormsg
$http_response_header
$argc
$argv
HTML && CSS
HTML
CSS
javascript
HTTP
HTTP body
HTTP header
Nginx
Client Server Architecture
REST
Web Session
Cookie Based
Relational Databases
other problem
for arabic language
mysqli_set_charset($conn, 'utf8');
UPDATE
Select
SQL Connection
PDO
mysqli_connect
DELETE
insert
ERROR Handling
SQL Syntax