`If string value(number) is less than 5 returns "Your number is less than 5!"
$st = strlen("game"); // returns 4
if ($st < 5 ) {
echo "Your number is less than 5!". "\n";
`
if number is more than 5, but less than 10 returns:
} elseif ($st < 10) {
echo "Your number is less than 10!". "\n";
`
And finally, if the number is higher than 10 returns:
} else {
echo "Your number is out of the range:("."\n";
}
`<?php
//Numeric Arrays
$names = array("Mate", "Giorgi", "Davit");
echo $names[1] . "\n";
$names[0] = "Mate";
$names[1] = "Giorgi";
$names[2] = "Davit";
// Associative Arrays
$people = array("Mate"=>"30", "Giorgi"=>"32", "Davit"=>"36");
// or
echo $people['Mate'] = "30" . "\n";
echo $people['Giorgi'] = "32" . "\n";
echo $people['Davit'] = "36" . "\n";
//Multi-Dimensional Arrays
$PEOPLE = array (
'Women' => array('Natalia', 'Elena', 'Inga'),
'Men' => array('Mate', 'Giorgi', 'Zura'),
'Kids' => array('Nia', 'Sofia', 'Rezi')
);
echo $PEOPLE['Kids'][0] . "\n";
echo $PEOPLE['Men'][2] . "\n";
echo $PEOPLE['Women'][1];
?>
<?php
// Variables
$my_name = "Mariam";
$my_weight = 70; //kg
$my_height = 1.77; //m
$live = "Tbilisi";
# About me
echo 'My name is '.$my_name.', I am '.$my_weight.'kg and my height is '.$my_height.', I live in '.$live.'.';
?>
/*
for multiple-line comment
this is also a comment block
and this one too
*/
// and #
// this is for Single line comment
# also For a single-line comment
/*... */
# - /*... */ For inline comment
$sum = 9 /* maybe + 16 */ + 17;
echo $sum;
/* String variable type - also called alphanumeric variables or character variables;
have values that are treated as text;
*/
Integer Variable Type
# Integer Variable type - Integers are whole numbers that can be positive, negative, or zero
Float Variable Type
/* Float Variable type - is a data type composed of a number that is not an integer.
it includes a fraction represented in decimal format;
*/
Boolean Variable Type
# Boolean Variable Type - can either be True or False;
Array Variable Type
// Array Variable type - is a data type that represents a collection of elements.