Datatypes in PHP – PHP WEBSITE DEVELOPMENT

In this video

We are going to start a new tutorial series “PHP Tutorial for Beginners” in Urdu language. A simple and short PHP tutorial and complete reference manual for all built-in PHP functions. These tutorials are for beginners to advance level. You will learn PHP Built-in Function, PHP syntax, datatypes in PHP, Object Oriented PHP, Numbers, Scalars, Arrays, Hash File I/O, IF, ELSEIF, Do, While Loops, Operators, Regular Expressions, GET, POST, Subroutines, Coding Standard, Modules, File Management, Socket Communication, Reference, Special Variables, Syntax Overview, Form Validation, Advanced PHP, Library, Web Design, PayPal Integration, MySQL Login, Ajax Search, Ajax XML Parser, Ajax Auto Complete Search, Ajax RSS Feed Example, XML Introduction, Simple XML, Simple XML GET, SAX Parser Example, DOM Parser Example, Frame Works, Core php vs frame works php, Design Patterns.

In our last lecture we learned about PHP variables. If you haven’t watched it yet then here is the link of tutorial http://tutorialhive.net/2018/09/08/3-php-variables-php-website-development/ . Today’s tutorial is about datatypes in PHP.

Datatypes in PHP

In this tutorial we will learn about datatypes in PHP and how to display them. First step is to run wamp server. Run wamp and after that go into drive where you installed wamp server. Open folder Wamp after that open folder www. Now create a new folder in ‘www‘you can give any name to your folder, I am naming it tutorialhive. In folder create a file with name index.php. In your editor open your php file.

Following are datatypes in PHP.

  1. String
  2. Int
  3. Float
  4. Boolean
  5. array

String

$name=”Husnain”;

Now if we want our system to tell datatype of this variable for that PHP has a built in function.

var_dump(here pass variable name); so our code will be

<?php

$name=”Husnain”;

var_dump($name);

?>

Open your browser and write localhost/folder name in which you have file/filename with extension and enter.

Output: string ‘Husnain’ (Length=7)

Int

Now if we want our system to tell datatype of this variable for that PHP has a built in function.

var_dump(here pass variable name); so our code will be

<?php

$weight=65;

var_dump($weight);

?>

Open your browser and write localhost/folder name in which you have file/filename with extension and enter.

Output: int 65

Here it is telling variable datatype and the value of variable.

Float

Now if we want our system to tell datatype of this variable for that PHP has a built in function.

var_dump(here pass variable name); so our code will be

<?php

$weight=65.5;

var_dump($weight);

?>

Output: float 65.5

Boolean

Now if we want our system to tell datatype of this variable for that PHP has a built in function.

var_dump(here pass variable name); so our code will be

<?php

$check=true;

var_dump($check);

?>

Output: Boolean true

Array

Now if we want our system to tell datatype of this variable for that PHP has a built in function.

var_dump(here pass variable name); so our code will be

<?php

$motorbikes=array(“Honda”,”Yamaha”,”Suzuki”);

var_dump($motorbikes);

?>

Built in function of php for initializing array is array();

Output: array (size=3)

0 => string ‘Honda’ (Length=5)

1 => string ‘Yamaha (Length=6)

2 => string ‘Suzuki (Length=6)

Data types in PHP tutorial end here. In next tutorial we will learn about string functions php. If you have any queries you can ask us on our Facebook page link is given below, Thank you for watching us.

ABOUT US

Tutorial Hive’s mission is to provide quality education to all our community. Tutorial Hive’s mission is to provide free education to all those who cannot afford BIG FEE of institutes. We aim specifically to empower youth to understand programming related knowledge which further helps the society to reduce complex problems through applications. Why Tutorial Hive? We not only provide the theoretical knowledge but also provide the actual implementation with working sample applications. Tutorial Hive cannot achieve its mission without the help of our community. So, please if you think you can help in any manner feel free to contact us. Or if you see any mistake in our content which can be modified/corrected then please leave us a message

We are always open for suggestions.

Facebook: www.facebook.com/hbss2015

Subscribe on YouTube: https://www.youtube.com/channel/UCOUy6kTpedj7s6HOqM0c08w

Follow us on Social Media

You might be interested in

LEAVE YOUR COMMENT

Your email address will not be published. Required fields are marked *