Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
The for Loop
The for loop is used when you know in advance how many times the script should run. Parameters: init: Initialize the loop counter value test: Evaluates each time the loop is iterated, continuing if evaluates to true, and ending if it evaluates to false increment: Increases the loop counter value
for ($i = 0; $i < 10; $i++) {
    echo "Value of i is: " . $i . "\n";
}
by Elena Kuparadze
3 years ago
0
PHP
Loop
0
Do While Loop
The do...while loop will always execute the block of code once, check the condition, and repeat the loop as long as the specified condition is true.
$i = 1;

do {
    echo "My name is Nia" . "\n";
    
    
} while ($i < 0); 
by Elena Kuparadze
3 years ago
0
PHP
Loop
0
String Variable Type
/* 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.
by Mariam Gelkhauri
3 years ago
0
PHP
PHP
Variable Types
Variables
Object Oriented PHP Tutorial
0
/* ........... .............. .............. */
/* 
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;
by Mariam Gelkhauri
3 years ago
0
PHP
Comment Types
PHP
PHP comments
PHP official doc
0
Example:
<?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.'.';

?>
by Mariam Gelkhauri
3 years ago
0
PHP
PHP
Variables
0
While Loop
The while loop executes a block of code as long as the specified condition is true.
$i = 1; 
  while ( $i < 40 ) {
    echo "I am " . $i . " years old" . "\n";
    $i ++;
}
by Elena Kuparadze
3 years ago
0
PHP
Loop
0
<?php

$baks = "bakari";
$country = "georgia";
$x = 10;
$y = 12;
$baksage = $x + $y;
$language = "php";
echo 'My name is '.$baks.', I am from '.$country.  ' and my age is '.$baksage. ', I am learning '  .$language. "!";
by Bakari Datiashvili
3 years ago
0
PHP
Object Oriented PHP Tutorial
1
Array Types in PHP
The are 3 types of Arrays in PHP : Numeric Array, Associative Array and Multidimensional Array.
<?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];

?>
by Elena Kuparadze
3 years ago
0
PHP
Arrays
0
The difference between operators (== and ===)
//if we use == sign it doesn't check the type of data apart from === sign which check also type of data <?php $a = 34; $b = 34; if($a == $b) { echo "Equal"; } else{ echo "Not Equal"; } //answer will be "Equal" true if('34' == 34){ echo "Equal"; } else{ echo "Not Equal"; } //answer will be "Equal" if('34' == 34){ echo "Equal"; } else{ echo "Not Equal"; } //answer will be "Not Equal" because types of variables isn't equal to each others ?>
by ana meskhi
3 years ago
0
PHP
1
The difference between post-increment and pre-increment
<?php $x= 7; $y= $x ++ // $x = 8; $y = 7 $x= 7; $y= ++$x // $x = 8; $y = 8 ?>
by ana meskhi
3 years ago
0
PHP
post-decrement
post-increment
pre-decrement
pre-increment
1
Results: 1578