Advertisement

Responsive Advertisement

BASIC PHP SYNTAX

New update will be soon available



What is PHP?

PHP is a server side scripting language. that is used to develop Static websites or Dynamic websites or Web applications. PHP stands for Hypertext Pre-processor, that earlier stood for Personal Home Pages.

PHP scripts can only be interpreted on a server that has PHP installed.

The client computers accessing the PHP scripts require a web browser only

Example 8

Write a program to display

<html>

<body>

<?php

class car{

function car() {

$this ->model="VW";

}}

//create an object

$bie=new car()

//show object properties

echo $bie->model;

?>

</body>

</html>

Example 9

<html>

<body>

<?php

$x="hello world";

$x=null;

var_dump($x);

?>

</body>

</html>

example 10

Write  a program to print output as:

<html>

<body>

<?php

$x="my college"

$y='my college'

echo $x;

echo"<br>";

echo $y;

?>

</body>

</html>

Example 11

Write a program  to display output as 10.365

<html>

<body>

<?php

$x=5985;

echo($x);

?>

</body>

</html>

Example 12

<html>

<body>

<?php

$x=10.365;

echo $x;

echo"<br>";

var_dump($x)

?>

</body>

</html>

Example 13

<html>

<body>

<?php

$cars=array("volvo","BMW",Toyota");

var-dump($cars);

?>

</body>

</html>

Example 14

<html>

<body>

<?php

class car {

function car(){

$this ->model="BMW";

}}

//creat an object

$bie=new car();

//show object properties

eco $bie->model;

?>

</body>

</html>

Example 15

<html>

<body>

<?php

$x=89;

$y=125;

echo"sum=",$x+$y;

?>

</body>

</html>

Example 16 

look output of the following program:

<html>

<body>

<?php

$txt="programming in PHP";

$txt="our college ";

$x=5;

$y=4;

echo "<h1>.$txt1."</h1>;

ECHO"class XII student of ".$txt2."<br>;

echo $x+$y."<br>;

echo "this","string ","was","made","with multiple parameters.";

?>

<\body>

<\html>


Post a Comment

0 Comments