It might be common for developers to host their own private packages for projects without having to submit them to popular public websites such as Packagist. Here’s how to set up private repositories using Satis with MAMP, for local testing.
As per the Composer documentation, you can install Satis via command line.
From your home ...
This post covers the Variable Scope section of the Functions chapter when studying for the Zend PHP 7 Certification.
The scope of a variable is the context within which it is defined.
For a simple procedural PHP script with no functions, the variables will be defined in the global scope.
Any functions added that ...
This post covers the Type Declarations section of the Functions chapter when studying for the Zend PHP 7 Certification.
You can use type declarations to specify the expected data type of an argument in a function declaration. In PHP 5.5, these were the allowed types introduced.
Class/interface name
self
array
callable
<?php
class ...
This post covers the Returns section of the Functions chapter when studying for the Zend PHP 7 Certification.
Return calls within a function end its execution immediately and pass control back to the line from which it was called. Any data type can be returned, and if a return statement is omitted, then NULL is ...
This post covers the References section of the Functions chapter when studying for the Zend PHP 7 Certification.
You can pass a variable by reference to a function so the function can modify the variable.
<?php
function foo(&$var) {
$var++;
}
$a = 5;
foo($a);
echo $a; // Outputs: 6
This post covers the Variables section of the Functions chapter when studying for the Zend PHP 7 Certification.
Variables declared within functions are only visible in that function. Similarly, variables declared outside of functions are visible everywhere outside of functions. In PHP, there is a global scope. Any variable declared outside of any function is ...
This post covers the Arguments section of the Functions chapter when studying for the Zend PHP 7 Certification.
Information may be passed to functions via the argument list, which is a comma-delimited list of expressions.
<?php
function somefunction($arg1, $arg2, $arg3) {
// Do something
}
Arguments are evaluated from left to ...
This post covers the Syntax section of the Functions chapter when studying for the Zend PHP 7 Certification.
Functions can be best described as packages of code that serve as instructions to execute an action. These packages are often re-used in projects to avoid code duplication.
Any valid PHP code can reside in a function, ...
Many projects are used to using CSS reset rules within their stylesheets as a way of resetting HTML elements to a base set of rules.
The resets, which can be found in many boilerplate CSS files along with Normalize ensures that the HTML elements are displayed consistently in browsers, including support for older browsers.
Here ...
This post covers the Objects as Arrays section of the Arrays chapter when studying for the Zend PHP 7 Certification.
The ArrayObject class allows objects to work as arrays.
Two constants are available in this class: STD_PROP_LIST and ARRAY_AS_PROPS.
STD_PROP_LIST ensures properties of the object have their normal functionality when accessed as list (var_dump, foreach, ...