PHP PROGRAMMING LANGUAGE-
Designed by- Rasmus Lerdorf.
First appeared -1994
Developer- The PHP Development Team, Zend Technologies.
File name extensions - .php
Php is server side scripting language which is use to create dynamic web pages. php stands for Hypertext Preprocessor.
Php file contains text,css,html,java script and php code. php code exicuted on server and result is return in php browser. php file has .php extention. PHP can generate dynamic page content.
it can be create, open, read, write, delete, and close files on the server. PHP can collect form data. it can be send and receive cookies it can add, delete, modify data in your database. PHP can be used to control user-access and encrypt the data.
Basically php programming language use for creating or developing dynamic website. php language is not much secure. but it is very easy to understand there function tags etc
FEATURES OF PHP-
- Simple and easy.
- Database connectivity.
- Familiarity.
- Platform independent.
- Flexibility
- Portability
- Object oriented programming.
- Error reporting
Php versions -
1.0 Release date- 8 June 1995
2.0 Release date- 1 November 1997
3.0 Release date- 6 June 1998
4.0 Release date- 22 May 2000
4.1 Release date- 10 December 2001
4.2 Release date- 22 April 2002
4.3 Release date- 27 December 2002
4.4 Release date- 11 July 2005
5.0 Release date- 13 July 2004
5.1 Release date- 24 November 2005
5.2 Release date- 2 November 2006
5.3 Release date- 30 June 2009
5.4 Release date- 1 March 2012
5.5 Release date- 20 June 2013
5.6 Release date- 28 August 2014
7.0 Release date- 3 December 2015
7.1 Release date- 1 December 2016
7.2 Release date- 30 November 2017
7.3 Release date- 6 December 2018
7.4 Release date- 28 November 2019
8.0 Release date- December 2020
PHP COMPILERS -
- Phalanger
- PeachPie
- HHVM
php basic programs
Q1)write a php program to print hello world.
-->
<?php
echo"hello world";
?>
output- hello world.
----------------------------------------------------------------
Q2)write a program in php to find factorial of given number.
-->
<?php
$num = 4;
$fact = 1;
for ($x=$num; $x>=1; $x--)
{
$fact = $fact * $x;
}
echo "Factorial of $num is $fact";
?>
output - Factorial of 4 is 24.
-------------------------------------------------------------
Q3) write a php program to swapping of two number using third variable.
-->
<?php
$a = 4;
$b = 7;
// Swapping Logic
$c = $a;
$a = $b;
$b = $c;
echo "After swapping:<br><br>";
echo "a =".$a." b=".$b;
?>
output - after swapping:
a=7 b=4
-----------------------------------------------------------------
Q5)write a php program to find sum of given number.
-->
<?php
function sum($num) {
$sum = 0;
for ($i = 0; $i < strlen($num); $i++){
$sum += $num[$i];
}
return $sum;
}
$num = "12";
echo sum($num);
?>
output - sum 3
-----------------------------------------------------------
Q6)write a php program to print array.
-->
<?php
$a=array('name'->'salman','age'->'20','add'->'pune')
print_r($a);
?>
output - array([name]->salman,
[age]->20,
[add]->pune)
function use for print array -
print_r()- this function is use for print array in php.
var_dump()- it is use to display structural information that is datatype or value.
-----------------------------------------------------------
Q6)write a php program to print array.
-->
<?php
$a=array('name'->'salman','age'->'20','add'->'pune')
print_r($a);
?>
output - array([name]->salman,
[age]->20,
[add]->pune)
function use for print array -
print_r()- this function is use for print array in php.
var_dump()- it is use to display structural information that is datatype or value.
4 Comments
👍
ReplyDelete👍😊
ReplyDeleteImpressive
ReplyDelete✌
ReplyDelete