Factorial of a non-negative integer, is multiplication of all integers smaller than or equal to n. For example factorial of 5 is 5*4*3*2*1 which is 120.

A prime number is a whole number greater than 1 whose only factors are 1 and itself.

Enter value of \$n

<?php
\$n = 2;
\$array = array(44,16,81,12);
\$unique = array();
\$unique = array_unique(\$array);
sort(\$unique);
echo \$height = \$unique[count(\$unique)-\$n];
?>

There are three way to find min value in array

There are three way to find max value in array

Swap number without third variable.

<?php
\$a=12;
\$b=15;
\$a=\$a+\$b;
\$b=\$a-\$b;
\$a=\$a-\$b;

echo \$a."<br />".\$b;
?>

Print only odd number

<?php
for(\$i=1; \$i<=25; \$i++) {
if(\$i%2 == 0) {
\$even[] = \$i;
} else {
\$odd[] = \$i;
}
}
echo implode(",",\$odd);
?>

Create Table

• CREATE TABLE MyGuests(id INT AUTO_INCREMENT PRIMARY KEY NOT NULL, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, email VARCHAR(50))

Primary Key

• Primary key cannot have a NULL value.
• Each table can have only one primary key.
• By default, Primary key is clustered index and data in the database table is physically organized in the sequence of clustered index.

• Where clause can be applied to a single row, where as Having clause is applied to the whole group.
• Having clause is used, when we want to use select query to filter data from a table based on a aggregate condition