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
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';
// $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;
$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";
$
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";
sudo npm install --unsafe-perm=true --allow-root
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