Results: 1580
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
Comparison between PHP and JS "problem solving" moduls (5) CODE
// Unlike JS, in PHP all variables are local in scope unless declared as global. so both languages are just opposite in declaring variables.
let x = 5;
let y = 3;
function sum() {
    console.log(x + y);
}
sum(); 
//outputs 8 in JavaScript,
$x = 3;
$y = 5;
function sum() {
    echo $x + $y;
}
sum();
//outputs error unless declaring variables
by Luka Khitaridze
2 years ago
0
JavaScript
PHP
Variables
0
switch(ball)
const balls = ball =>{ switch(ball) { case `კალათბურთი`: console.log(`${ball} კალათბურთის ბურთია`); break; case `ფეხბურთი`: console.log(`${ball} ფეხბურთის ბურთია`); break; case `რაგბი`: console.log(`${ball} რაგბის ბურთია `); break; default: console.log(` არ არის არც კალათბურთის არც ფეხბურთის არც რაგბის ბურთი `); } } balls(`ტენისი`);
by Bakari Datiashvili
2 years ago
0
JavaScript
switch
JavaScript
0
Comparison between PHP and JS "problem solving" moduls (6) CODE
/* JavaScript is a case senitive language when it comes to variables, function and class declarations, while PHP is not case sensitive in function and class declarations. */
function writeMsg() {
  console.log("hello world")
}
WRITEMSG();
// outputs reference error
function writeMsg() {
  echo "Hello world";
}
WRITEMSG();
// outputs Hello world
by Luka Khitaridze
2 years ago
0
JavaScript
PHP
Syntax
0
$double = 1.345;
printf("%f\n", $double);
to print 2 digits after comma use %.2f or any number
printf("%.2f", $double);
by Vasil Grdzelishvili
2 years ago
0
PHP
console
0
for ციკლი
const money = [`dollar`, `euro`, `Sterling`, `Bitcoin`]; for (let i = 0; i < money.length; i++) { console.log(money[i]); } /* output : dollar euro Sterling Bitcoin*/
by Bakari Datiashvili
2 years ago
0
JavaScript
Array
for loop
JavaScript
0
Difference between echo and print
Echo
echo is a statement, which is used to display the output. echo can be used with or without parentheses. echo does not return any value. We can pass multiple strings separated by comma (,) in echo. echo is faster than print statement.
Print
print is also a statement, used as an alternative to echo at many times to display the output. print can be used with or without parentheses. print always returns an integer value, which is 1. Using print, we cannot pass multiple arguments. print is slower than echo statement.
by Tinatin Kvinikadze
2 years ago
0
PHP
output
0
PHP $ and $$ Variables
The $var (single dollar) is a normal variable with the name var that stores any value like string, integer, float, etc. The $$var (double dollar) is a reference variable that stores the value of the $variable inside it.
by Tinatin Kvinikadze
2 years ago
0
PHP
variables
0
This function are case-sensitive
echo str_replace("World","Peter","Hello world!");
output: Hello Peter!
This function are case-insensitive
echo str_ireplace("WORLD","Peter","Hello good world!");
output: Hello good Peter!
by saba chankvetadze
2 years ago
0
PHP
string
0
== and === operator in PHP
What is the difference between == and === operator in PHP ? In PHP == is equal operator and returns TRUE if $a is equal to $b after type juggling and === is Identical operator and return TRUE if $a is equal to $b, and they are of the same data type
<?php 
 $a=true ;
 $b=1;
 // Below condition returns true and prints a and b are equal
 if($a==$b){
  echo "a and b are equal";
 }
 else{
  echo "a and b are not equal";
 }
 //Below condition returns false and prints a and b are not equal because $a and $b are of  different data types.
 if($a===$b){
  echo "a and b are equal";
 }
 else{
  echo "a and b are not equal";
 }
?>
``
by Tinatin Kvinikadze
2 years ago
0
PHP
operator
0
== and === operator in PHP ? In PHP == is equal operator and returns
What is the difference between
==
and
===
operator in PHP ? In
PHP
== is equal operator and returns
TRUE
if $a is equal to $b after type juggling and === is Identical operator and return
TRUE
if $a is equal to $b, and they are of the same data type
$a=true ;
 $b=1;
 // Below condition returns true and prints a and b are equal
 if($a==$b){
  echo "a and b are equal";
 }
 else{
  echo "a and b are not equal";
 }
 //Below condition returns false and prints a and b are not equal because $a and $b are of  different data types.
 if($a===$b){
  echo "a and b are equal";
 }
 else{
  echo "a and b are not equal";
 }
by Tinatin Kvinikadze
2 years ago
0
PHP
0
Results: 1580