What is package.json in Node.js? Features, Uses and Examples

Image
  Introduction to package.json  in Node.js When developers start working with Node.js , they often create projects using different libraries, frameworks, and tools. Managing all these project requirements manually can become difficult. This is where the package.json file becomes useful. The package.json file is an important part of almost every Node.js project. It stores essential information about an application, including its name, version, description, dependencies , development tools, and scripts. 2. What is package.json The package.json file is a JSON (JavaScript Object Notation) file used in Node.js projects to store project information and configuration. It works as a project information file that describes the application and tells npm which packages, scripts, and other settings are required. Every Node.js project can have its own package.json file. It is generally located in the root directory of the project. For example , consider a project named m...

PHP program palindrome number

 palindrome number in php

 

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 ::- 

·        Palindrome Number use in  form in php

Example :-

<form method="post">
    Enter a number
    <input text="text" name="number">
    <br></br>
    <button type="submit">Check number</button>
</form>
<?php
if($_POST)
{
    $number=$_POST['number'];
    $reverse=strrev($number);
    if($number==$reverse){
        echo"The number  $number is polindrome";
    }
    else{
        echo"The number $number is not a
polindrom";

    }
    }
?>

   Output :-



 Recommended Articles 

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

CSS Outline Offset Property with Practical Examples