Skip to main content

Builtin or Predefined Functions in PHP

Tutorial Title: Builtin or Predefined Functions in PHP
Course: PHP
Instructor: Muhammad Samim




1.  Predefined Math Functions in PHP
  • Math predefined functions make easier coding
  • echo pow(2,7); //2 power of 7 will be displayed
  • echo rand(1, 1000); //Random numbers between 1 and 1000
  • echo sqrt(100); //Square root of 100  
  • echo ceil(5.6) // Round up of 5.6
  • echo floor(5.6) //Round down of 5.6
  • echo round(5.6) //Round of 5.6
  • For more Click Here!



2. Predefined String Functions in PHP
  • $variableName = "Muhammad Samim";
  • echo strlen($variableName); //Length of string inside $variableName
  • echo strtoupper($variableName); //Converting to upper case of string inside $variableName
  • echo strtolower($variableName); //Converting to lower case of string inside $variableName
  • Fore more Click Here!

3. Predefined Array Functions in PHP
  • Predefined functions for arrays
  • $arrayName = [345,56,6,78,45,3543,0];
  • echo max($arrayName); //Displays the maximum number in array
  • echo min($arrayName); //Displays the minimum number in array
  • print_r ($arrayName); //Showing complete structure of array before understanding sorting
  • sort($arrayName); //Sort the array in ascending order
  • For more Click Here!

Comments

Popular posts from this blog

External Page Submission/Submission to another page

Tutorial Title:   External Page Submission/Submission to another page Course: PHP Instructor: Muhammad Samim 1. Submitting action from one page to another page 2. First make one page with name page1.php <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <title>Document</title> </head> <body>      <form action="page2.php" method="post"> //It will direct from page1.php to page2.php           <br><input type="text" placeholder="Email" name="anyNameForEmail">     <br><input type="password" placeholder="Password" name="anyNameForPassword">     <br><input type="submit" name="click">    </form>   </body> </html> 3. Second make another file with name page2.php <?php if(isset($_POST["click"])){     $anyNameO...

Extracting Information from form

Tutorial Title:  Extracting Information from form Course: PHP Instructor: Muhammad Samim 1. <?php if(isset($_POST["anyName"])) { $anyNameOfVariableForEmail = $_POST["anyNameForEmail"]; //Now because of it email must be typed otherwise it will not work $anyNameOfVariableForPassword = $_POST["anyNameForPassord"];//Now because of it password must be typed otherwise it will not work echo $anyNameOfVariableForEmail; //It will display the email echo $anyNameOfVariableForPassword; //It will display the password } ?> <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <title>Document</title> </head> <body>      <form action="21form.php" method="post">        <input type="text" placeholder="Email" name="anyNameForEmail">        <input type="password" placeholder="...