This post covers the PCRE section of the Strings chapter when studying for the Zend PHP 7 Certification.
The PCRE (Perl Compatible Regular Expression) library is one that can contains functions that implement regular expression patterns.
When using the PCRE functions, it is required that the pattern is enclosed by delimiters.
Often used delimiters are ...
This post covers the Formatting section of the Strings chapter when studying for the Zend PHP 7 Certification.
A number of functions are available in PHP that assist with formatting a string, such as printf and sprintf to name a couple of commonly used ones.
The printf() function outputs a formatted string. There is no ...
This post covers the Replacing section of the Strings chapter when studying for the Zend PHP 7 Certification.
Some of the string functions for replacing characters in a given string can be seen below.
The str_replace function replaces all occurrences of the search string with the replacement string. It can take up to four parameters.
This post covers the Searching section of the Strings chapter when studying for the Zend PHP 7 Certification.
Some of the string functions for searching characters in a given string can be seen below.
The strpos() function finds the position, starting from zero, of the first occurrence of a substring in a string. The function ...
This post covers the Extracting section of the Strings chapter when studying for the Zend PHP 7 Certification.
Some of the string functions for extracting characters in a given string can be seen below.
The substr() function returns part of a string. It takes three parameters.
String – The input string that must be ...
This post covers the Matching section of the Strings chapter when studying for the Zend PHP 7 Certification.
There are a variety of functions in PHP we can use to compare and match two strings. Equal comparison operators used to compare if two strings are equal.
$string1 = 'string';
$string2 = 'something else';
var_dump($string1 ...
This post covers the Quoting section of the Strings chapter when studying for the Zend PHP 7 Certification.
A string literal can be specified in different ways.
Single quoted
Double quoted
HEREDOC/NOWDOC, which can be seen here
Single quoted strings will display things almost completely “as is.” Variables and most escape sequences will ...
This post covers the HEREDOC & NOWDOC section of the Strings chapter when studying for the Zend PHP 7 Certification.
HEREDOC
The heredoc syntax uses the operator: <<<. After this operator, an identifier is provided, then a newline. The string itself follows, and then the same identifier again to close the quotation.
<?php
$string ...
Many bugs have been submitted to the Magento 2 Github page, and whilst lots have been fixed, there are many waiting to be fixed and included in upcoming versions. None more so than the Magento 2 knockout translation bug.
This bug is fairly easy to replicate in a blank install of Magento 2, and can ...
This post covers the Anonymous Functions section of the Functions chapter when studying for the Zend PHP 7 Certification.
Anonymous functions, which are also known as closures, allow the creation of functions which have no specified name. They are most useful as the value of callback parameters, but they have many other uses.
<?php
$arr ...