PHP Syntax

Overview

  • Configure

    // single qoutes vs double qoutes // Strings in double qoutes will processed by php before being outputted. // single qoutes are more effiecent // dot . is concatination operator echo 'Hello', .

  • Configure

    Comparison Operators // These boolean statements will always evaluate to TRUE or FALSE // compare equality 42 === 42 //is true '1' == 1 // is true '1' === 1 // is false 5 > 5 10 < 15 10 >= 15 10 <= 20 !

  • Functions and Objects in PHP

    Functions Functions are like variables for lines of codes. return a variable print something out. // function being treated as variable function is_bigger(){ return 10>=5; } if (is_bigger()){ echo " " } else { } // passing arguments to functions function is_bigger($a, $b){ return $a>=$b; } $bigger = is_bigger(10, 5) finding built in functions open https://www.

  • Including External Files in PHP

    Server Side Includes A way of including multiple files in a single php file, before its sent to the browser. Theres only one http request. Benifits Break up large sections of code.

  • Loops in PHP

    “While [SOME CONDITION] is true, execute [CODE]. if [SOME CONDITION] becomes false, move on.” A true/false condition. A statement that moves that condition towards becoming false. Types of Loops in PHP WHILE LOOPS FOR LOOPS FOR EACH LOOPS

  • Math in PHP

    $num = 20; echo -$num // output is -20 /* PEMDAS 1. Parentheses 2. Exponents 3. Multiplication/Division 4. Addition/Subtraction */ // 5 squared echo 5**2; //Moddulus Operator $a % 2 == 0 // is even $a % 2 !

  • Processing Forms in PHP

    Difference Between Get and Post Method Get Method it is used when we want the results to be shareable and data to be muteable. Get request has limits in storing or retriving data from 2000 to 8000 depending on the broswer and server configurations.

  • Troubleshooting in PHP

    Turned on by Default error_reporting = E_ALL display_errors = On Turned of by Default error_log = syslog log_errors = On html_errors = On Using PHP Functions for Debugging error_reporting error_reporting is built in function in php.

I will get back to you ASAP.