Skip to main content

Posts

Showing posts from December, 2017

Forms in PHP

Tutorial Title:  Forms in PHP Course: PHP Instructor: Muhammad Samim 1. $_POST is a global super variable 2. It picks up the data in post forms 3. Declaring form <form action=""></form> //Or in Bracket editor just type form and press tab button rest will be come automatically 4. Declaring input in form and some types of it <input type="text">           //for text box <input type="password"> //for password <input type="submit">    //for submit button 5. Declaring placeholder in input inside form <input type="text" placeholder="Email"> //Email will be displayed inside the textbox <input type="password" placeholder="Password"> //Password will be displayed inside password box 6. Complete coding to understand <?php        //It will not be executed unless we don't click or enter the submit button if(isset($_POST["anyName...

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 th...

Custom Function in PHP

Tutorial Title:  Custom Function in PHP Course: PHP Instructor: Muhammad Samim 1 . Defining Functions in PHP User defined function is a piece of program that can be used calling by its name. It saves a lot of time and makes easier to code. function anyName(){ echo "Powered by Muhammad Samim"; } //it will not be shown until we don't call anyName(); //Displays whatever function contains 2. Passing Parameters Functions in PHP function anyName($number1, $number2){ $sum = $number1 + $number2; echo $sum; } anyName(300,60.55); //These two numbers will be passed through variables $number1 and $number2 and will be added to be stored in variable $sum to be displayed. 3. Returning Values from Functions Using keyword return of PHP in function to make it more flexible.  function anyName($number1, $number2){ $sum = $number1 + $number2; return $sum; } $result = anyName(300,400); echo $result . "<br>"; //Here we can use the stored value ...

Control Structures in PHP

Tutorial Title:  Control Structures in PHP Course: PHP Instructor: Muhammad Samim 1. If, elseif and else statements in PHP These are the conditions which are applied to control the flow of program if(3<2) { echo "First condition";} elseif (3>10) {echo "Second condition;} else {echo "all conditions are false";} //"all conditions are false" will be displayed because because above both conditions are false 2. Comparison operators in PHP Equal == //e.g 3 == "3" This condition will be true, datatypes are change but values are same Identical ===   //To identify if both values are same and of same datatype e.g 3 === "3" This condition will be false because values are same but datatypes are change Less than < Greater than > Less than or Equal to <= Greater than or Equal to >= Less than or Greater than <> Not Equal  != Not Identical !== 3. Logical Operators in PHP And &...

Data Types and More in PHP

Tutorial Title:  Data Types and More in PHP Course: PHP Instructor: Muhammad Samim 1. Variables in PHP Variable means container which keeps the data. Different types of Variables store different types of data Variables in PHP are case sensitive Variable starts with $ symbol in PHP Variable cant be started with numbers Variable can't have - $variableName = "Muhammad Samim"; //String data $variableName = 200; //Numbers $variableName = 200.5; //Float echo $variableName; //Displays whats inside variable echo $variableName . $variableName; //Dot will concatenate two variables echo $variableName . " " .   $variablename; //Will give space between data of two variable while displaying. PHP string variable can store HTML tags inside e.g $variableName = "<h1>Muhammad Samim </h1>"; 2. Math in PHP Precedence applies in doing maths in PHP echo 200 / 200; //Displays the result of Division echo 200 * 200; //Displays the result...

Dynamic Data and Inserting Comments in PHP

Tutorial Title: Dynamic Data and Inserting Comments in PHP Course: PHP Instructor: Muhammad Samim 1. Intro Displaying same content in multiple pages using variable  2. Advantage If we want to change the content like owner name etc then changing in one place will make change in all pages so we don't need to change in every page. 3. How to do that <?php $variableName = "Content"; ?> 4. Calling by VariableName <?php echo $variableName; ?> 5. One line comment use //  before comment 6. Multiple line comments use /* in start and */ at the end of multiple lines comment

Downloading Installing and Configuring Brackets Editor for PHP

Tutorial Title:  Downloading Installing and Configuring Brackets Editor for PHP Course: PHP Instructor: Muhammad Samim 1. Downloading Go to the link  http://brackets.io/ Click on Download Brackets 2. Installing Go to the folder of downloaded file Double click on file to install 3. Configuring Click on File Click on Project Settings and Enter below address http://localhost/projectFolderName 4. Adding extension (Emmet) Click on File Click on Extension Manager Search Emmet Select and Click on Install 5. Adding extension (mobokai) dark background (Optional) Click on File Click on Extension Manager Click on Themes Search monokai Find and select scheme from sublime text and Install Click on View Click on Themes Click on Current Theme and Select Monokai  Click on Done

Installing XAMPP and configuring on Linux Ubuntu

Tutorial Title:  Creating environment for PHP (Installing XAMPP and Configuring) Course: PHP Instructor: Muhammad Samim 1. Downloading XAMPP Go to the link  https://www.apachefriends.org/index.html Click on XAMPP for Linux (Latest version will be downloaded) 2. Installing XAMPP Go to folder where XAMPP file was downloaded Right click and click on Open in Terminal and run below commands ($ is not included in command but an indicator of Terminal) $ sudo chmod +x filename.run $ sudo ./xampp-linux-x64-7.1.11-0-installer.run Keep everything default and click next and install 3. Configuring XAMPP (In case not running of MySQL Database) Open XAMPP Click on Manage Servers Click on MySQL Databse to be selected Click on Configure Change port 3306 to 3307 Click on OK  Click on Start to Run MySQL Database 4. Running Server Open your browser Type localhost and enter 5. Creating Launcher for XAMPP Open Terminal a...