PHP Questions Flashcards
What does (=) do?
Assigns a value
What does (==) do?
Checks if values are the same
What does (===) do?
Checks if values are the same and of same type
What does echo do?
Outputs what is passed to it
What does print do?
Outputs what is passed to it and acts as function for passing comples statements
What does printf do?
Used for formatting output
What does include do?
Includes a file each time it’s called
What does include_once do?
Will only include file when first called
What does require do?
Same as include but results in error if file not found
How are variables passed to functions?
By value unless it is passed with an ‘&’, which would make it by reference
What is the differance between crypt() and md5()?
crypt() is used for encrypting something that be decrypted later. md5() produces a hash, which cannot be decrypted
What are PHP Statics?
Elements that can be accessed from any context. Like calling a method from another class without needing to instantiate that class
What is POST?
An array of variable passed via http post method
What is GET?
Array of variable passed via http url parameters
What is SESSION?
Array of variables that can be preserved accross acccess of a site, usually stored in memory or database
What is inheritance?
Mechanism of deriving a new class from an existing class while keeping attributes and behaviors of parent class
What is polymorphism?
Classes with differant functionality while sharing a common interface
What is an abstract class?
A mix between an interface and a class. It defines a class that must be extended in order to be used.
What is encapsulation?
Wrapping of data within an object with data structures and methods to act on them
Whats differant in PHP 5 over PHP 4
Static methods and properties, visibility propherties (public, private, protected), constructors and destructors, abstract classes, interfaces, magic metods, autoload, type hinting, exceptions
What does public property do?
Allows a method or property to be accessible and modifiable by everyone
What does private property do?
Makes methods and properties available to the class they reside in only
What does protected property do?
Makes methods and properties available to class they reside in, and child or parent classes
What are interfaces?
An interface defines the methods a class must implement without having to define how they are handled
What are magic methods?
PHP functions with reserved names startng with ‘__’ : __call()
What does type hinting do?
Allows for enforcement of variable types passed to functions or methods
What is registered globals?
PHP setting that allows for creation of global variables for many server variable and query string parameters - should be off