You are previewing PHP Quick Scripting Reference.
O'Reilly logo
PHP Quick Scripting Reference

Book Description

The PHP Quick Scripting Reference is a condensed scripting code and syntax reference to the PHP scripting language, the most popular Web scripting language in use today. It presents the essential PHP script in a well-organized format that can be used as a handy reference.

You won't find any technical jargon, bloated samples, drawn out history lessons or witty stories in this book. What you will find is a Web scripting language reference that is concise, to the point and highly accessible. The book is packed with useful information and is a must-have for any PHP programmer or Web developer

In the PHP Quick Scripting Reference, you will find:

  • A concise reference to the PHP scripting language syntax.

  • Short, simple and focused code examples.

  • A well laid out table of contents and a comprehensive index allowing easy review.

What you'll learn

  • What is PHP and how to get started with it

  • What are variables, operators, strings, arrays, conditionals, loops and more in scripting setting

  • How to script with functions, class, inheritance, and deal with access levels

  • How to script with static, constants, interface, abstracts, traits

  • How to import files

  • What are Type Hinting and Type Conversions and how to use these in scripting for Web applications

  • How to do variable testing, overloading, sessions

  • What are and how to deal with various scripting for Cookies

  • How to handle namespaces, references, advanced variables, error handling and exception handling

Who this book is for

This book is a handy, pocket quick scripting syntax reference for experienced PHP as well as perhaps other programmers and Web developers even new to PHP

Table of Contents

  1. Title Page
  2. Contents at a Glance
  3. Contents
  4. About the Author
  5. Introduction
  6. CHAPTER 1: Using PHP
    1. Embedding PHP
    2. Outputting text
    3. Installing a web server
    4. Hello world
    5. Compile and parse
    6. Comments
  7. CHAPTER 2: Variables
    1. Defining variables
    2. Data types
    3. Integer type
    4. Floating-point type
    5. Bool type
    6. Null type
    7. Default values
  8. CHAPTER 3: Operators
    1. Arithmetic operators
    2. Assignment operators
    3. Combined assignment operators
    4. Increment and decrement operators
    5. Comparison operators
    6. Logical operators
    7. Bitwise operators
    8. Operator precedence
    9. Additional logical operators
  9. CHAPTER 4: String
    1. String concatenation
    2. Delimiting strings
    3. Heredoc strings
    4. Nowdoc strings
    5. Escape characters
    6. Character reference
    7. String compare
  10. CHAPTER 5: Arrays
    1. Numeric arrays
    2. Associative arrays
    3. Mixed arrays
    4. Multi-dimensional arrays
  11. CHAPTER 6: Conditionals
    1. If statement
    2. Switch statement
    3. Alternative syntax
    4. Mixed modes
    5. Ternary operator
  12. CHAPTER 7: Loops
    1. While loop
    2. Do-while loop
    3. For loop
    4. Foreach loop
    5. Alternative syntax
    6. Break
    7. Continue
    8. Goto
  13. CHAPTER 8: Functions
    1. Defining functions
    2. Calling functions
    3. Function parameters
    4. Default parameters
    5. Variable parameter list
    6. Return statement
    7. Scope and lifetime
    8. Anonymous functions
    9. Function overloading
    10. Built-in functions
  14. CHAPTER 9: Class
    1. Instantiating an object
    2. Accessing object members
    3. Initial property values
    4. Constructor
    5. Destructor
    6. Case sensitivity
    7. Object comparison
  15. CHAPTER 10: Inheritance
    1. Overriding members
    2. Final keyword
    3. Instanceof operator
  16. CHAPTER 11: Access Levels
    1. Private access
    2. Protected access
    3. Public access
    4. Var keyword
    5. Object access
    6. Access level guideline
  17. CHAPTER 12: Static
    1. Referencing static members
    2. Static variables
    3. Late static bindings
  18. CHAPTER 13: Constants
    1. Const
    2. Define
    3. Const and define
    4. Constant guideline
    5. Magic constants
  19. CHAPTER 14: Interface
    1. Interface signatures
    2. Interface example
    3. Interface usages
    4. Interface guideline
  20. CHAPTER 15: Abstract
    1. Abstract methods
    2. Abstract example
    3. Abstract classes and interfaces
    4. Abstract guideline
  21. CHAPTER 16: Traits
    1. Inheritance and traits
    2. Trait guideline
  22. CHAPTER 17: Importing Files
    1. Include path
    2. Require
    3. Include_once
    4. Require_once
    5. Return
    6. Auto load
  23. CHAPTER 18: Type Hinting
  24. CHAPTER 19: Type Conversions
    1. Explicit casts
    2. Settype
    3. Gettype
  25. CHAPTER 20: Variable Testing
    1. Isset
    2. Empty
    3. Is_null
    4. Unset
    5. Determining types
    6. Variable information
  26. CHAPTER 21: Overloading
    1. Property overloading
    2. Method overloading
    3. Isset and unset overloading
  27. CHAPTER 22: Magic Methods
    1. Tostring
    2. Invoke
    3. Object serialization
    4. Sleep
    5. Wakeup
    6. Set state
    7. Object cloning
  28. CHAPTER 23: User Input
    1. HTML form
    2. Sending with post
    3. Sending with get
    4. Request array
    5. Security concerns
    6. Submitting arrays
    7. File uploading
    8. Superglobals
  29. CHAPTER 24: Cookies
    1. Creating cookies
    2. Cookie array
    3. Deleting cookies
  30. CHAPTER 25: Sessions
    1. Starting a session
    2. Session array
    3. Deleting a session
  31. CHAPTER 26: Namespaces
    1. Creating namespaces
    2. Nested namespaces
    3. Alternative syntax
    4. Referencing namespaces
    5. Namespace aliases
    6. Namespace keyword
    7. Namespace guideline
  32. CHAPTER 27: References
    1. Assign by reference
    2. Pass by reference
    3. Return by reference
  33. CHAPTER 28: Advanced Variables
    1. Curly syntax
    2. Variable variable names
    3. Variable function names
    4. Variable class names
  34. CHAPTER 29: Error Handling
    1. Correcting errors
    2. Error levels
    3. Error handling environment
    4. Custom error handlers
    5. Raising errors
  35. CHAPTER 30: Exception Handling
    1. Throwing exceptions
    2. Try-catch statement
    3. Catch block
    4. Finally block
    5. Re-throwing exceptions
    6. Uncaught exception handler
    7. Errors and exceptions
  36. Index