Monday, March 20, 2023

php-lesson1(variables)

NULL Type in PHP

The Type NULL has only one possible value which is the value NULL.To give a variable the NULL value you should simply assign it such as follows: $MyVariable = NULL; the NUL type is capitalized by...

Boolean Types in PHP

Boolean contains TRUE or FALSE value, which is specificly used in if statements that is one of the baces in control structure. Boolean provides constants that are TRUE and FALSE Interpreting other Types as Booleans there are...

Double Type in PHP

doubles are floating point-numbers I wil exmaple a double Example: $My_double = 385.874; $My_double2 = 1.5; $My_double3 = 0.556; $My_double4 = 9.0; $My_double5 = 0.00003; when doubles are having a rounded number it will not save it as an integer, and will...

Integer Type in PHP

Integer types are simple, the contain the simple positive and negetive numbers and they can both assigned directly or bypassign an expression to a variable Example: $Myint= 684 $sample number = 8496-48683 yo can also assigne other integer...

Variable Types in PHP

There are totally eight type is PHP;integeres, double, Booleans, strings, arrays, object, NULL and resources here is to have a summary of all of these variables that PHP contains Integers are the whole numbers without a...

Constants in PHP

PHP offers constants which their value will not be reassigned regardless of ehat variables do so their value will be consistent. Constants definitions: Constants do not have $ before their name and by convention they...

Variable Scope In PHP

Scope is a technical term which exist in every programming language, that provide a rule for name of the variables has the same meaning in two difrent places any php variable not inside a function...

Working with unset() function in PHP

if you are in a state to restore a variable to its unassigned state you can use unset() Function Example: unset($assigned_var) this will make the $assigned_var variabel to the default value of which type it can hold...

testing if a variable is assigned in PHP with isset() function

PHP has a function isset that tests whether a variable is assigned or has default value this function gets one argument in the paranteses that is the variable to test, and return a boolean ehich...

Variables default values in PHP

Variables in PHP do not have intrinsic types - a variable does not know wether it will be used as a string of characters or a number. so you may ask yourself how does it...