xxxxxxxxxx
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.2
xxxxxxxxxx
sudo dpkg -l | grep php | tee packages.txt
sudo add-apt-repository ppa:ondrej/php # Press enter when prompted.
sudo apt update
sudo apt install php8.2 php8.2-cli php-8.2{bz2,curl,mbstring,intl}
sudo apt install php8.2-fpm
# OR
# sudo apt install libapache2-mod-php8.2
sudo a2enconf php8.2-fpm
# When upgrading from older PHP version:
sudo a2disconf php8.1-fpm
## Remove old packages
sudo apt purge php8.1*
xxxxxxxxxx
sudo apt install php8.0-cli php8.0-common php8.0-imap php8.0-redis php8.0-snmp php8.0-xml
xxxxxxxxxx
const numbers = [1, 2, 3, 4, 5];
for (i = 0; i < numbers.length; i++) {
console.log(numbers[i]);
}
xxxxxxxxxx
/* new options with IE6: loop through array of objects */
const people = [
{id: 100, name: 'Vikash'},
{id: 101, name: 'Sugam'},
{id: 102, name: 'Ashish'}
];
// using for of
for (let persone of people) {
console.log(persone.id + ': ' + persone.name);
}
// using forEach(...)
people.forEach(person => {
console.log(persone.id + ': ' + persone.name);
});
// output of above two methods
// 100: Vikash
// 101: Sugam
// 102: Ashish
// forEach(...) with index
people.forEach((person, index) => {
console.log(index + ': ' + persone.name);
});
// output of above code in console
// 0: Vikash
// 1: Sugam
// 2: Ashish
xxxxxxxxxx
var arr = [1, 2, 3, 4, 5];
for (var i = arr.length - 1; i >= 0; i--) {
console.log(arr[i]);
}
xxxxxxxxxx
sudo apt update
sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common -y
sudo add-apt-repository ppa:ondrej/php
xxxxxxxxxx
var min = arr[0];
var max = arr[0];
for(var i=1; i<arr.length; i++){
if(arr[i] < min){
min = arr[i];
}
if(arr[i] > max){
max = arr[i];
}
return [min, max];
}
xxxxxxxxxx
let arr = [1, 2, 3, 4]
for (let i = 0; i < arr.length; i++) {
console.log(arr[i])
}