Saturday, January 20, 2018

phpMyPassion

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: ".$third;

?>

Output :-

Two Numbers Sum: 50


About Author -

Hi, I am Anil.

Welcome to my eponymous blog! I am passionate about web programming. Here you will find a huge information on web development, web design, PHP, Python, Digital Marketing and Latest technology.

Subscribe to this Blog via Email :

Note: Only a member of this blog may post a comment.