Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
Differences between echo and print CODE
1.
echo
can take multiple parameters
echo 'one', 'two', 'three', "\n";
2.
print
statement returns 1
$print_returns = print('some text')."\n";
echo "print_returns Value: $print_returns" . "\n";
echo
prints 1 after
print
statement is executed
echo print "123", "\n";
3.
echo
is a little bit faster than
print
by Valeri Tandilashvili
3 years ago
0
PHP
echo / print
4
echo statement CODE
Prints plain text
echo 'plain text'."\n";
Double quotes can parse variables
echo "Double quotes: $text"."\n";
Single quotes can not parse variables
echo 'Single quotes: $text'."\n";
Single quotes as well as double quotes can be concatenated with variables
echo 'Single quotes - '.$text." - Double quotes"."\n";
Text inside Single quotes can include double quotes as part of the text
echo 'The text includes "double" quotes as part of the text'."\n";
Text inside double quotes can include single quotes as part of the text
echo "Jane's surname is Smith"."\n";
echo can be used as a function
echo ('echo as a function')."\n";
echo can print number without quotes
echo 5 . $number;
echo
can take multiple parameters
echo 'one', 'two', 'three', "\n";
We can print multiple lines of text
echo 'Prints text 
    with multiple
lines';
by Valeri Tandilashvili
3 years ago
0
PHP
echo / print
5
PHP Comments CODE
Single line comment
// $variable = 'Value';
Another single line comment
# $variable = 'Value';
Comment for multiple lines
/*$variable = 'Value';
$second_variable = 'Value 2';
$third_variable = 'Value 3';*/
Inline comment
$number = 5 /* - 5  */ + 5;
by Valeri Tandilashvili
3 years ago
0
PHP
Comments
5
PHP Variables CODE
Different types of Variables
$name = "George";
$age = 25;
$weight = 75; //kg
$height = 1.85; //m
Variables used in expressions
echo "His name is ".$name."\n";
echo "He is ".$age." years old\n";
echo "He weighs around ".$weight."\n";
echo "he is ".$height."m tall \n";
by Valeri Tandilashvili
3 years ago
5
PHP
Variables
9
Rules to create PHP variable CODE
- A variable starts with the
$
sign, followed by the name of the variable - A variable name must start with a letter or the underscore character - A variable name cannot start with a
number
- A variable name can only contain alpha-numeric characters and underscores (
A-z
,
0-9
, and
_
)
// Correct Syntax
$variable_name = "Value";

// Incorrect Syntax
Variable_Name = "Value";
$5variable_name = "Value";
$variable-name = "Value";
by Valeri Tandilashvili
3 years ago
0
PHP
Variables
6
Laravel could not read .env file
Solution to the problem:
composer dump-autoload
php artisan cache:clear
php artisan config:clear
php artisan view:clear
by Valeri Tandilashvili
3 years ago
0
Laravel
artisan
0
in_array for Multidimensional array
foreach($taxonomy_tree as $item){

                   $taxonomy_item_family = (json_encode($item));

                    $string = '"id":"1"';

                   if (str_contains($taxonomy_item_family, $string)) {
                        dd($item);
                    }


                }
by Giorgi Ivanidze
3 years ago
0
PHP
array
0
sudo npm install --unsafe-perm=true --allow-root
by Luka Tatarishvili
3 years ago
0
0
by Luka Tatarishvili
3 years ago
0
PHP
20.04
22.04
ubuntu
0
1:
sudo apt update
2:
sudo apt -y upgrade
3:
sudo systemctl reboot
maybe this fails but not problem Add Ondřej Surý PPA repository: 4.1
sudo apt update
4.2
sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common -y
4.3
sudo add-apt-repository ppa:ondrej/php
5:
sudo apt update
install PHP 8.1 6:
sudo apt install php8.1
Hit the y key to start installation Check for the current version of PHP 7:
php -v
by Luka Tatarishvili
3 years ago
0
PHP
20.04
ubuntu
0
Results: 1578