PHP Basics Tutorial: Accessing PHP, Variables, Data Types

PHP Programming for Beginners – Variables, Data Types & PHP Access

PHP full is hypertext preprocessor.olden days php full form is personal home page but now more developments are arrived.thats why it changes to hypertext preprocessor.

Php is used to design server based web pages.it makes connection to the home page to server by using html and PHP.html is used for only web page creation and PHP is used for server connecting web page.

Sample application on php:

<?php

echo “welcome to the world…!”

?>

Output:-

welcome to the world…!

Explanation:

echo anedi manaki printf Ela use avuthundo php lo echo alane print cheyadaniki use chestam.

Importance of php:

1.easy to learn:-manam easy ga nerchukoni web page ni create cheyochu

2.platform independent:-E browser lo naina manam install chesukovochu

3.open source:-andaru free ga use chesukovochu.

4.fast execution:-execution anedhi fast ga jarigi output display chestundi

Accessing php files:

After completion of writing php code we should the file as filename.php.here is .php is the extension for php code.

filename.php

How to open the saved file in php:

In any browser search it as

http://localhost/filename.php

Creating sample application of php using variables:

Variable is used to store the values.

Syntax for variable is:

$variablename=value;

Program:

<?php

$name=”sunflower”;

$number=143;

echo $name.”<br>”;

echo $number;

?>

Output:

sunflower

143

Explanation:-

$name ane variable lo sunflower ane value ni store chesukundi.

$number ane variable lo 143ane value ni store chesukundi.

<br>anedi use cheyatam avana a statement break ayyi next line lo print avuthundi.

echo anedi output screen lo print avvataniki use chestam.

identifier in php:

identifier are used for variable names.

$print=”easy subject”;

Here is

$print is variable

print is a identifier

easy subject is a value of the variable.

Data types of php:

There are many data types in php

Integer

Float

Array

String

Boolean

Null

Data types declaration:

For integer:

$num=123;

For float:

$num=12.5;

For string:

$name=”apple”;

For Boolean:

$value=true;

For Null:

$var=Null;

Example program:

<html>

<head>

<title>my program</title>

<body>

<?php

$name=”prabhas”;

$age=21;

$marks=45;

$course=”degree”;

echo $name.”<br>”;

echo $age.”<br>”;

echo $marks.”<br>”;

echo $course.”<br>”;

?>

</body>

</head>

</html>

Output:

prabhas

21

45

degree.

2 thoughts on “PHP Basics Tutorial: Accessing PHP, Variables, Data Types”

Leave a Comment