Results: 1580
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
$empty_Array = []; // returns false, in JS it returns true $test0 = 0; // returns false $test1 = 1; // returns true $string_Zero = '0'; // returns false, in JS it returns true $quotes = ' '; // returns false $null = null; // returns false
if (0) {                            // false same as empty, true same as 1
	echo "true";
} else {
	echo "false";
}
// therefore condition returns false :)
by Luka Khitaridze
2 years ago
0
PHP
JS
PHP
0
The PHP while Loop
The
while
loop executes a block of code as long as the specified condition is true.
$x = 1;
while($x <= 100) {
    echo "The number is $x". "\n";
    $x+=10;
}
by Eka Suarishvili
2 years ago
0
PHP
0
small program
// პროგრამა დააბრუნებს წლის დღეს (ციფრს) შესაბამისი გრამატიკული ფორმატით //(date'z') ფუნქცია აბრუნებს წლის მიმდინარე რაოდენობრივ დღეს 1-დან 365-ის ჩათვლით
<?php
$today =(date'z');  
if ($today==1) {
    echo "დღეს არის წლის $today-ლი დღე";
}
elseif ($today>=2 and $today<=20) {
    echo "დღეს არის წლის მე-$today დღე";
}else
echo "დღეს არის წლის $today-ე დღე";
?>
by Guram Azarashvili
2 years ago
0
PHP
PHP official doc
0
პროგრამა ბეჭდავს რიცხვებს 1-50, ხუთს-ხუთს თითო ხაზზე
<?php  
for ($i=1;$i<=50;$i++)  {
    echo "$i ";
      if ($i%5==0) {
       echo "\n";
    }
    
}
?>
by Guram Azarashvili
2 years ago
3
PHP
0
The code will return an array with 2 elements.
$str = "Hello world";
print_r (explode(" ",$str));
Return:
Array ( [0] => Hello [1] => world )
The code will return a string containing the elements of the array.
$arr = array('Hello','World!');
echo implode(" ",$arr);
Return:
Hello World!
by saba chankvetadze
2 years ago
0
PHP
PHP official doc
0
<?php
$my_name = "oto";
$my_weight = 70; //kg
$my_height = 177; //m

$his_name = "guduna";
$his_weight = 77;
$his_height = 200;

if ($my_weight < $his_weight) {
  echo "hi is fatter!  ";
}


if ($my_height < $his_height) {
	echo "hi is taller!";
	
}
by otar datuadze
2 years ago
0
PHP
if statement
0
Arithmetic Operators
<?php
$number1 = 9;
$number2 = 4;
echo $number1 - $number2 . "\n";
echo $number1 + $number2 . "\n";	
echo $number1 / $number2 . "\n";
echo $number1 * $number2 . "\n";
echo $number1 % $number2 . "\n";
/* Result
5
13
2.25
36
1
*/
by otar datuadze
2 years ago
2
PHP
Arithmetic Operators
0
Comments
<?php
// You can also use comments to leave out parts of a code line
$x = 5 /* + 15 */ + 5;
echo $x;
?>
# this is single-line comment
// tshi is another single-line comment
/* this is for  
multiple-lines 
comment 
block
*/
by otar datuadze
2 years ago
0
PHP
0
Assign multiple variables
Assign multiple variables:

$a = $b = $c = 10;
echo "a = $a, b = $b, c = $c";

$person = ['Nika Kobaidze', 34];

[$name, $age] = $person;

echo "My name is: $name I'm $age years old";
by Nika Kobaidze
2 years ago
0
PHP
PHP official doc
0
In first case 'result' will be 'false' because && operator executes first and result will be assign to 'result'. Like this: $result = ("First" && false);

$result = "First" && false;
var_dump($result);
result will be 'First', because first executes $result = "First" and next execute AND operator. Like this: ($result = "First") && false;

$result = "First" AND false;
var_dump($result);
by Nika Kobaidze
2 years ago
0
PHP
operator priority
PHP official doc
0
Results: 1580