“Find odd even number ” is the basic PHP program for a PHP learner. As you all aware, Odd numbers are not divisible by 2 and Even numbers are divisible by 2. Example : Odd number: 3, 5, 7, 9,11 Even number: 2, 4, 6, 8, 10 So here I am gonna explain it with a simple PHP program. Odd Even Number Program :- <?php $number=22; if($number%2==0) { echo “22 is an even number”; } else { echo “22 is not odd number”; } ?> Output…
Category: Basic PHP Programs
Swap Two Number Program In PHP
Swap two number generally is the process of interchange two variables with each other. Just suppose you have X whose value 10 there is another number Y with value of 20. Now if we swap these two number with each other then the X value will change to 20 and Y value will change to 10. So here I am gonna explain with a simple PHP program. Swap Two Number Program :- <?php $x=10; $y=20; echo “Value of x: $x</br>”; echo “Value of y: $y</br>”; $temp=$x; $x=$y; $y=$temp; echo “Value of x:…
Adding Two Numbers in PHP
We can add two numbers in PHP as like other programming language. “Two Numbers Addition” is the initial program from where most of the beginner developers will start to learn and write code in any language. Here is an example of add two numbers in PHP. Adding Two Numbers Program :- We use $ symbol to declare variable and add two variables. we take third number to store result in third variable. Below is the simple PHP program to add two numbers. <?php $first=30; $second=20; $third=$first + $second; echo “Two Numbers Sum:…
How to Print Hello World Program in PHP ?
In PHP it is very easy to print “Hello World” program. “Hello World.” is the first program from where most of the beginner developers will start to write code in any language. Here is an example of how to print “Hello World!!” in PHP. Print “Hello World” Program :- In PHP we use echo to print a string and we always write the PHP code between <?php ?> tag. Below are the example of print simple Hello World. <?php echo “Hello World!!”; ?> Output :- Hello World!! Check video :-
PHP Introduction
What is PHP:- PHP stands for PHP: Hypertext Preprocessor , it is widely – used server side scripting language designed for web devlopment. PHP also used as a general purpose programming language. It was build up by Rasmus Lerdorf in 1994 and launched in the market in 1995. PHP is the most well known scripting language on the web. It is utilized to improve site pages. Using PHP, you can do things like a login page and login a user by creating session, check details from a form, create forums, picture galleries, surveys, and…