This document provides a history and overview of PHP, a widely used open source scripting language for web development. It discusses the origins and creators of PHP, the major versions released over time with new features, and some of the standard data types that can be used in PHP like integers, strings, arrays, and objects. The document also introduces basic PHP concepts like variables, data types, and how the gettype() function can be used to determine the type of a variable.
10. វិទ្យាស្ថា នពហុបច្ចេកច្ទ្យសច្េត្តបាត្់ដំបង POLYTECHNICINSTITUTEOFBATTAMBANGPROVINCE
Developing web Application with PHP Prepare By: DY CHANDOEUN Page 10
5.6 Logical Operators>
Logical Operators
Operator Name Returns True if... Example Result
|| Or Left or right is true
true ||
false
True
Or Or Left or right is true
true ||
false
true
Xor Xor Left or right is true but not both
true xor
true
false
&& And Left and right are true
true &&
false
false
And And Left and right are true
true &&
false
false
! Not The single operand is not true ! true false
Logical operators bMElg operand eGayeTACatMél Boolean rYceFVIkareRbobeFobtMélTaMgenaH .
Or operator b¤( || ) pþl;tMél true RbsinebIoperand xageqVg b¤ xagsþaMNamYymantMél true .
]TahrN_ 1> true || false lT§plKW true .And operator b¤ ( && ) pþl;tMél true enAeBlEdl operand
TaMgBIrmantMél true .
]TahrN_2> true && false lT§plKWfalse .
]TahrN_3> ( $x > 2 ) && ( $x < 15 )
5.7 Increment/Decrement Operators
Increment/decrement operators eRbIedIm,IbegáIn b¤ bnßytMél rbs; variable EdlCa Integer
ehIyCaTUeTAeRbIedIm,Irab; Iteration rbs;loop .
$x = $x + 1; // $x is incremented.
$x += 1; // $x is incremented.
$x++; // $x is incremented
. $x = $x - 1; // $x is decremented.
$x--; // $x is decremented.
$x- = 1; // $x is decremented.
11. វិទ្យាស្ថា នពហុបច្ចេកច្ទ្យសច្េត្តបាត្់ដំបង POLYTECHNICINSTITUTEOFBATTAMBANGPROVINCE
Developing web Application with PHP Prepare By: DY CHANDOEUN Page 11
Operator Name Effect on $var Value of the Expression
$var++ Post-increment $var is incremented by 1
The previous value of
$var
++$var Pre-increment $var is incremented by 1
The new value of $var
(incremented by 1).
$var-- Post-decrement $var is decremented by 1
The previous value of
$var
--$var Pre-decrement $var is decremented by 1
The new value of $var
(decremented by 1).
]TahrN_
$num1 = 5;
$num2 = $num1++; // post-increment, $num2 RtUv)anpþl;nUvtMéledImrbs;$num1
print $num1; // lT§plEdlnwgRtUvbgðajKWtMélrbs; $num1 KW 6
print $num2; // lT§plEdlnwgRtUvbgðajKWCatMéledImrbs; $num1 KW 5
]TahrN_³
$num1 = 5;
$num2 = ++$num1; // pre-increment, $num2 RtUv)anpþl;nUvtMélfµIrbs; $num1
eTAeGay $num2 .
print $num1; // lT§plEdlnwgRtUvbgðajKWtMélrbs; $num1 KW 6
print $num2; // lT§plEdlnwgRtUvbgðajKWCatMélrbs; $num1 KW 6
6.Constants >
CaTUeTA Variables RtUv)aneKeRbIedIm,IpÞúknUvtMél BIeRBaHtMél nig RbePTrbs;vaGac
nwgRtUvpøas;bþÚr)anRKb;eBlevla . RbsinebIGñkcg;eFVIkarCamYytMélEdlminERbrRbYlenAkñúgkar RbtibtþikarkUdrbs;Gñk
GñkGaceRbIR)as;nUvconstant . PHP )anpþl;nUvdefine() function edIm,I
begáItnUv constant .
define("CONSTANT_NAME", 42); >