Posts

Showing posts with the label PHP Program

React Installation and Requirements: Complete Beginner's Guide

Image
React.js Tutorial: Installation, Requirements and First Project 1. Introduction React.js is one of the popular JavaScript libraries used to create modern and interactive websites. Today, many websites need more than simple HTML pages. Users expect fast page updates, interactive buttons, dynamic forms, smooth navigation and attractive user interfaces. React helps developers create these features in an organized way. If you are a beginner learning web development, React is a useful technology to add to your skills. Before writing your first React application, you should understand its basic requirements, installation process and working principles. In this tutorial, we will learn what React.js is, how it started, its important features, advantages and disadvantages, and how React works. We will also explore practical code examples that you can try on your computer. This guide is designed for students, beginners and anyone who wants to start learning frontend development. By...

PHP using leap year program

Image
 PHP Using leap year program                          Leap Year  1]  leap year is the one  has 366 days in a year. 2] leap year comes after every four years. 3]  leap year is always a multiple of four. 4] For example,1999,2000, 2007,2008,2009,2010, 2020, 2024, etc are leap years. Q.  Leap Year Program php   Example <?php function isLeap ( $year ) {     return ( date ( 'L' , mktime ( 0 , 0 , 1 , 1 , $year ))== 1 ); }     for ( $year = 1991 ; $year < 2016 ; $year ++)     {         if ( isLeap ( $year ))         {             echo " $year : LEAP YEAR <br> \n " ;         }         else         {             echo " $year :Not leap year<br> \n " ;         }   ...

PHP program using sum of digits

Image
Q. Sum of Digits in php   Example :- <?php $number = 1222 ; $sum = 0 ; $rem = 0 ; for ( $i = 0 ; $i <= strlen ( $number ); $i ++) {     $rem = $number % 10 ;     $sum = $sum + $rem ;     $num = $number / 10 ; } echo " number is $number = Addition of digits <br> Answer is $sum " ; ? > Sum of Digits in php  Output:- Q. Sum of digit using form  php Example :- < form method = "post" >     Enter number     < input type = "number" name = "number" >< br >< br >     < input type = "submit" value = "submit" > </ form > <?php if ( $_POST ) { $number = $_POST [ 'number' ]; $sum = 0 ; $rem = 0 ; for ( $i = 0 ; $i <= strlen ( $number ); $i ++) {     $rem = $number % 10 ;     $sum = $sum + $rem ;     $number = $number / 10 ; } echo " number is $number Addition of digits <br> Answer is $sum " ; } ? > Sum of...

armstrong number program in php

Image
Armstrong number PHP Program Armstrong number  1] one whose value is equal to the sum of the cubes of its digits.   2]  There are Four 3digit Armstrong number - 153, 370, 370 , 407, 1634, 8208,  etc Armstrong number program in php Example :- <?php $num = 150 ; $total = 0 ; $x = $num ; while ( $x != 0 ) {     $rem = $x % 10 ;     $total = $total + $rem * $rem * $rem ;     $x = $x / 10 ; } if ( $num == $total ) {     echo "Yes it an Armstrong number" ; } else {     echo "Not an Armstrong Number" ; } ? > armstrong number program in php Output :- armstrong number program using form php Example :- < form method = "post" >     Enter number     < input type = "number" name = "number" >< br >< br >     < input type = "submit" value = "submit" > </ form > <?php if ( $_POST ) {     $num = $_POST [ 'number' ];     $a = $num ; ...

PHP Program factorial number program

Image
Factorial number  Factorial number  1] Factorial   numbers   "!"   It   is   indicated   by   the   icon. 2]   means   that   all   negative   numbers   are   less   than      f or   equal   to   the   product   of   the   given   positive   numbers factorial number program in php Example :- <?php $number = 9 ; $factorial = 1 ; for ( $a = $number ; $a >= 1 ; $a --) {     $factorial = $factorial * $a ; } echo "Factorial of $number is $factorial " ; ? > factorial number program in php Output :- factorial number using form php Example :- < form method = "post" >     Enter The Number < br >< br >     < input type = "number" name = "number" id = "number" >< br >< br >     < input   type = "submit" name = "submit" value = "submit" > <...

PHP program palindrome number

Image
 palindrome number in php   palindrome number  ::- 1] palindrome number is a number which remains same digits reversed. 2] eg ::- number - 24142 is a palindrome number.   on reversing same digits . 1) take a number .  2) Reverse the input digits. 3) compare the two digits. 4) If equal it is digits is palindrome.    palindrome number in php Example ::- <?php function palindrome ( $n ){     $number = $n ;     $sum = 0 ;     while ( floor ( $number ))     {         $rem = $number % 10 ;         $sum = $sum * 10 + $rem ;         $number = $number / 10 ;     }   return $sum ; } $input = 1235321 ; $num = palindrome ( $input ); if ( $input == $num ){ echo " $input is a palindrome number" ; } else {     echo " $input is not a palindrome" ;     } ? >  palindrome number in php   Output ::- ...

how to run php program

Image
  How To Run A PHP Code In  XAMPP How to Install XAMPP ?  1]   Apachefriends developed XAMPP .  2] XAMPP available for everyone free of cose,  3] download XAMPP through the official website       https://www.apachefriends.org/download.html ∴   completing the download of the  setup file, than installation process  "select components"             section , select all the required components.  setup    ∴  Next, Select the directory where you want the software to be installed.it is recommended that you        use default directory "c\xampp" and click on "next " to complete the installation. How to Start a New PHP Program In XAMPP ? 1]  Before you run or start  writing any program in php ,you start Apache & MYSQL. 2] next starting both servers, you have to write a program in Notepad, visual studio code ...... etc. 3]  next writin...

php program to check whether a number is positive or negative

Image
Check whether a number  Q. program to check whether a number is positive or negative or Zero  Example ::- <?php $no = 49 ; $result =( $no > 0 )? "positive no" : "Negative no" ; echo $result ; ? >  o utput ::- positive no  Q. php program to check whether a number is positive or negative or Zero  Form.    Example <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = " width=device-width, initial-scale=1.0" >     < link rel = "stylesheet" href = " css/bootstrap.css" >     < title > Document </ title > </ head > < body class = "bg-primary" > < div class = "bg-white col-md-4 mx-auto mt-5 p-3" > < h5 > positive/negative /zero </ h5 >     < form action = "accept-posi-nega-no.php" method = "get" >     < ...

php program check to even or odd number

Image
Even odd Program php even odd program Information ::- 1 ]   Those EVEN Number  - 2,4,6,8,10 etc. 2] those divisible by 2 number . 1] Those ODD Number - 1,3,5,7,9,11 etc. 2]   Not divisible by  2 Number. PHP Even Odd Program  Example :- <?php $no = 100 ; if ( $no % 2 == 0 ) {     echo " $no is even number" ; } else {   echo " $no is odd number" ; } ? > php even odd program Output :- Even odd Program using FORM in php  Example :- < form action = "evenor-odd-form.php" method = "get" >     < input type = "number"   name = "number" value = "number" required >     < input type = "submit" value = "show" name = "b1" >   </ form > <?php   if ( isset ( $_GET [ 'b1' ]))   {   /* input  */   $no = $_GET [ 'number' ];     $result =( $no % 2 == 0 )? "no even" : "no odd" ;   echo " $result " ;   }   ? >...