Sunday, 28 February 2021

PHP core tutorial

      Introduction to PHP
      How PHP works?
      Install php on Mac
      Hello World application
      Php: apache: hello world application
      Access query parameters
      post form example
      Basic syntax
      variables
      Variable references
      echo: print the data to console
      comments: Documenting the code
      Php: data types
      Booleans
      is_bool: check variable holds Boolean value or not
      strings
      Single vs double quotes
      in place substitution of variables in a string
      Concatenate strings
      Escape characters
      built-in string functions
            strtolower: Get the string in lowercase form
            strtoupper: Get the string in uppercase form
            ucfirst: Make a string's first character uppercase
            lcfirst: Make a string's first character lowercase
            ucwords: Uppercase the first character of each word in a string
            strlen: Get string length
            ltrim, rtrim, trim : Trim the string
            strrev: Reverse a string
            substr: Return part of a string
      NULL: Represent nothing
      Emptiness
      Constants
      Arrays
            Add an element to the array
            Add an element to associate array
            Update values of array using reference
            Array pointers
            Basic array functions
                  array: count: count number of elements in the array
                  Array: max, min: get maximum and minimum value of array
                  sort: Sort the elements of array in ascending order
                  rsort: Sort array contents in descending order
                  is_array(): Chek whether a variable is an array
                  in_array: Check for existence of an element
      Operators
            Comparison operators
            <=>: Spaceship operator
            Logical operators
            Arithmetic operators
            what is the sign of modulo operator result?
            ++, --: increment and decrement operators
      Conditional statements
      if statement
      php is loosely coupled: === operator
      else statement
      if – else if - else statement
      Ternary operator
      switch statement
      while loop
      do-while loop
      for-each loop
      break statement: exit from the loop
      continue statement
      multi-dimensional arrays
            Access elements in a multi-dimensional array
      functions
            Access variables defined outside of a function
            Set default value to function argument
            functions: return a value from function
            Functions: pass the argument by reference
            Anonymous function
            Classes and objects
            How to define a class?
            get_declared_classes: Get all the classes that Php knows
            class_exists: Check whether class is defined or not
            How to get an object from class?
            Add properties to class definition
            Add methods to the class definition
            $this: refer to current instance properties
            Convert an object to string
            Class inheritance
            Override method definitions in subclass
            Access specifiers (or) visibility modifiers
            Adding dynamic properties, overloading
            Setter and getter methods
            Static properties
            static methods
            Access static properties from super classes
            new self(): Return instance of the class where new statement is defined
            new self() vs new static()
            Class level constants
            How to refer parent class properties, methods from sub class
            __construct: Constructor method
            Constructors and inheritance
            Why to use array as an argument to constructor definition
            clone an object
            __clone called while cloning an object
            Object are assigned by reference
            Implement singleton design pattern
            How to compare two objects?
      Return multiple values from a function
      Organizing your code
      include_once, require_once
      Interfaces
            class implement multiple interfaces
      Traits
      Abstract classes
      namespaces
      namespace: access entities using aliases
      Exception handling
      How to throw an exception
      Handle Exceptions
      try and multiple catch statements
      finally block
      uncaught exception handler
Previous                                                    Next                                                    Home

No comments:

Post a Comment