Complete PHP Secrets & Tips for Professionals

Complete PHP Secrets & Tips for Professionals

PHP CompleteComplete Tips & Secrets for Professionals TipsPHP & Secrets for Professionals 300+ pages of professional hints and tricks Disclaimer This is an unocial free book created for educational purposes and is GoalKicker.com not aliated with ocial PHP group(s) or company(s). Free Programming Books All trademarks and registered trademarks are the property of their respective owners Contents About ................................................................................................................................................................................... 1 Chapter 1: Getting started with PHP ................................................................................................................... 2 Section 1.1: HTML output from web server .................................................................................................................. 2 Section 1.2: Hello, World! ............................................................................................................................................... 3 Section 1.3: Non-HTML output from web server ........................................................................................................ 3 Section 1.4: PHP built-in server ..................................................................................................................................... 4 Section 1.5: PHP CLI ....................................................................................................................................................... 5 Section 1.6: Instruction Separation ............................................................................................................................... 6 Section 1.7: PHP Tags .................................................................................................................................................... 7 Chapter 2: Variables .................................................................................................................................................... 7 Section 2.1: Accessing A Variable Dynamically By Name (Variable variables) ...................................................... 8 Section 2.2: Data Types ................................................................................................................................................ 9 Section 2.3: Global variable best practices ............................................................................................................... 11 Section 2.4: Default values of uninitialized variables .............................................................................................. 13 Section 2.5: Variable Value Truthiness and Identical Operator ............................................................................. 13 Chapter 3: Arrays ........................................................................................................................................................ 15 Section 3.1: Initializing an Array .................................................................................................................................. 16 Section 3.2: Check if key exists .................................................................................................................................. 18 Section 3.3: Validating the array type ....................................................................................................................... 19 Section 3.4: Creating an array of variables .............................................................................................................. 19 Section 3.5: Checking if a value exists in array ........................................................................................................ 19 Section 3.6: ArrayAccess and Iterator Interfaces .................................................................................................... 20 Chapter 4: Functional Programming ............................................................................................................... 23 Section 4.1: Closures .................................................................................................................................................... 23 Section 4.2: Assignment to variables ........................................................................................................................ 24 Section 4.3: Objects as a function ............................................................................................................................. 24 Section 4.4: Using outside variables .......................................................................................................................... 25 Section 4.5: Anonymous function .............................................................................................................................. 25 Section 4.6: Pure functions ......................................................................................................................................... 26 Section 4.7: Common functional methods in PHP ................................................................................................... 26 Section 4.8: Using built-in functions as callbacks .................................................................................................... 27 Section 4.9: Scope ....................................................................................................................................................... 27 Section 4.10: Passing a callback function as a parameter ..................................................................................... 27 Chapter 5: Types ......................................................................................................................................................... 28 Section 5.1: Type Comparison .................................................................................................................................... 28 Section 5.2: Boolean .................................................................................................................................................... 29 Section 5.3: Float ......................................................................................................................................................... 30 Section 5.4: Strings ...................................................................................................................................................... 30 Section 5.5: Callable .................................................................................................................................................... 32 Section 5.6: Resources ................................................................................................................................................ 32 Section 5.7: Type Casting ........................................................................................................................................... 33 Section 5.8: Type Juggling ......................................................................................................................................... 34 Section 5.9: Null ........................................................................................................................................................... 34 Section 5.10: Integers .................................................................................................................................................. 34 Chapter 6: Autoloading Primer ............................................................................................................................ 35 Section 6.1: Autoloading as part of a framework solution ...................................................................................... 35 Section 6.2: Inline class definition, no loading required ........................................................................................... 36 Section 6.3: Manual class loading with require ........................................................................................................ 36 Section 6.4: Autoloading replaces manual class definition loading ...................................................................... 37 Section 6.5: Autoloading with Composer .................................................................................................................. 37 Chapter 7: Exception Handling and Error Reporting ............................................................................... 38 Section 7.1: Setting error reporting and where to display them ............................................................................. 38 Section 7.2: Logging fatal errors ............................................................................................................................... 38 Chapter 8: Working with Dates and Time ...................................................................................................... 39 Section 8.1: Getting the dierence between two dates / times .............................................................................. 39 Section 8.2: Convert a date into another format ..................................................................................................... 40 Section 8.3: Parse English date descriptions into a Date format ........................................................................... 41 Section 8.4: Using Predefined Constants

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    404 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us