mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-05 05:27:28 +02:00
Use language independent permalinks for php.net urls
@see http://php.net/urlhowto.php
This commit is contained in:
@@ -8,5 +8,5 @@ anchor: use_the_current_stable_version
|
||||
|
||||
If you are getting started with PHP, start with the current stable release of [PHP 5.6][php-release]. PHP has added powerful [new features](#language_highlights) over the last few years. Though the incremental version number difference between 5.2 and 5.6 is small, it represents _major_ improvements. If you are looking for a function or its usage, the documentation on the [php.net][php-docs] website will have the answer.
|
||||
|
||||
[php-release]: http://www.php.net/downloads.php
|
||||
[php-docs]: http://www.php.net/manual/en/
|
||||
[php-release]: http://php.net/downloads.php
|
||||
[php-docs]: http://php.net/manual/
|
||||
|
@@ -12,4 +12,4 @@ With PHP 5.4 or newer, you can start learning PHP without installing and configu
|
||||
|
||||
* [Learn about the built-in, command line web server][cli-server]
|
||||
|
||||
[cli-server]: http://www.php.net/manual/en/features.commandline.webserver.php
|
||||
[cli-server]: http://php.net/features.commandline.webserver
|
||||
|
@@ -35,7 +35,7 @@ The solutions listed above mainly handle PHP itself, and do not supply things li
|
||||
|
||||
[Homebrew]: http://brew.sh/
|
||||
[Homebrew PHP]: https://github.com/Homebrew/homebrew-php#installation
|
||||
[mac-compile]: http://www.php.net/manual/en/install.macosx.compile.php
|
||||
[mac-compile]: http://php.net/install.macosx.compile
|
||||
[xcode-gcc-substitution]: https://github.com/kennethreitz/osx-gcc-installer
|
||||
|
||||
["Command Line Tools for XCode"]: https://developer.apple.com/downloads
|
||||
|
@@ -48,14 +48,14 @@ available as `__call()` and `__callStatic()`.
|
||||
* [Read about Magic Methods][magic-methods]
|
||||
* [Read about Reflection][reflection]
|
||||
|
||||
[namespaces]: http://php.net/manual/en/language.namespaces.php
|
||||
[overloading]: http://php.net/manual/en/language.oop5.overloading.php
|
||||
[oop]: http://www.php.net/manual/en/language.oop5.php
|
||||
[anonymous-functions]: http://www.php.net/manual/en/functions.anonymous.php
|
||||
[closure-class]: http://php.net/manual/en/class.closure.php
|
||||
[callables]: http://php.net/manual/en/language.types.callable.php
|
||||
[magic-methods]: http://php.net/manual/en/language.oop5.magic.php
|
||||
[reflection]: http://www.php.net/manual/en/intro.reflection.php
|
||||
[traits]: http://www.php.net/traits
|
||||
[call-user-func-array]: http://php.net/manual/en/function.call-user-func-array.php
|
||||
[namespaces]: http://php.net/language.namespaces
|
||||
[overloading]: http://php.net/language.oop5.overloading
|
||||
[oop]: http://php.net/language.oop5
|
||||
[anonymous-functions]: http://php.net/functions.anonymous
|
||||
[closure-class]: http://php.net/class.closure
|
||||
[callables]: http://php.net/language.types.callable
|
||||
[magic-methods]: http://php.net/language.oop5.magic
|
||||
[reflection]: http://php.net/intro.reflection
|
||||
[traits]: http://php.net/language.oop5.traits
|
||||
[call-user-func-array]: http://php.net/function.call-user-func-array
|
||||
[closures-rfc]: https://wiki.php.net/rfc/closures
|
||||
|
@@ -29,6 +29,6 @@ package then you almost certainly want to look into PSR-4.
|
||||
* [Read about PSR-0][psr0]
|
||||
* [Read about PSR-4][psr4]
|
||||
|
||||
[namespaces]: http://php.net/manual/en/language.namespaces.php
|
||||
[namespaces]: http://php.net/language.namespaces
|
||||
[psr0]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
|
||||
[psr4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md
|
@@ -10,4 +10,4 @@ The Standard PHP Library (SPL) is packaged with PHP and provides a collection of
|
||||
|
||||
* [Read about the SPL][spl]
|
||||
|
||||
[spl]: http://php.net/manual/en/book.spl.php
|
||||
[spl]: http://php.net/book.spl
|
||||
|
@@ -48,10 +48,10 @@ Hello, world
|
||||
* [Learn about running PHP from the command line][php-cli]
|
||||
* [Learn about setting up Windows to run PHP from the command line][php-cli-windows]
|
||||
|
||||
[phpinfo]: http://php.net/manual/en/function.phpinfo.php
|
||||
[cli-options]: http://www.php.net/manual/en/features.commandline.options.php
|
||||
[argc]: http://php.net/manual/en/reserved.variables.argc.php
|
||||
[argv]: http://php.net/manual/en/reserved.variables.argv.php
|
||||
[php-cli]: http://php.net/manual/en/features.commandline.php
|
||||
[php-cli-windows]: http://www.php.net/manual/en/install.windows.commandline.php
|
||||
[phpinfo]: http://php.net/function.phpinfo
|
||||
[cli-options]: http://php.net/features.commandline.options
|
||||
[argc]: http://php.net/reserved.variables.argc
|
||||
[argv]: http://php.net/reserved.variables.argv
|
||||
[php-cli]: http://php.net/features.commandline
|
||||
[php-cli-windows]: http://php.net/install.windows.commandline
|
||||
[exit-codes]: http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
|
||||
|
@@ -59,5 +59,5 @@ foreach ($periodIterator as $date) {
|
||||
* [Read about DateTime][datetime]
|
||||
* [Read about date formatting][dateformat] (accepted date format string options)
|
||||
|
||||
[datetime]: http://www.php.net/manual/book.datetime.php
|
||||
[dateformat]: http://www.php.net/manual/function.date.php
|
||||
[datetime]: http://php.net/book.datetime
|
||||
[dateformat]: http://php.net/function.date
|
||||
|
@@ -45,7 +45,7 @@ Finally, If you are building an distributed application and cannot be certain th
|
||||
enabled, then consider using the [patchwork/utf8] Composer package. This
|
||||
will use `mbstring` if it is available, and fall back to non UTF-8 functions if not.
|
||||
|
||||
[Multibyte String Extension]: http://php.net/manual/en/book.mbstring.php
|
||||
[Multibyte String Extension]: http://php.net/book.mbstring
|
||||
[patchwork/utf8]: https://packagist.org/packages/patchwork/utf8
|
||||
|
||||
### UTF-8 at the Database level
|
||||
@@ -128,19 +128,19 @@ header('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
### Further reading
|
||||
|
||||
* [PHP Manual: String Operations](http://php.net/manual/en/language.operators.string.php)
|
||||
* [PHP Manual: String Functions](http://php.net/manual/en/ref.strings.php)
|
||||
* [`strpos()`](http://php.net/manual/en/function.strpos.php)
|
||||
* [`strlen()`](http://php.net/manual/en/function.strlen.php)
|
||||
* [`substr()`](http://php.net/manual/en/function.substr.php)
|
||||
* [PHP Manual: Multibyte String Functions](http://php.net/manual/en/ref.mbstring.php)
|
||||
* [`mb_strpos()`](http://php.net/manual/en/function.mb-strpos.php)
|
||||
* [`mb_strlen()`](http://php.net/manual/en/function.mb-strlen.php)
|
||||
* [`mb_substr()`](http://php.net/manual/en/function.mb-substr.php)
|
||||
* [`mb_internal_encoding()`](http://php.net/manual/en/function.mb-internal-encoding.php)
|
||||
* [`mb_http_output()`](http://php.net/manual/en/function.mb-http-output.php)
|
||||
* [`htmlentities()`](http://php.net/manual/en/function.htmlentities.php)
|
||||
* [`htmlspecialchars()`](http://www.php.net/manual/en/function.htmlspecialchars.php)
|
||||
* [PHP Manual: String Operations](http://php.net/language.operators.string)
|
||||
* [PHP Manual: String Functions](http://php.net/ref.strings)
|
||||
* [`strpos()`](http://php.net/function.strpos)
|
||||
* [`strlen()`](http://php.net/function.strlen)
|
||||
* [`substr()`](http://php.net/function.substr)
|
||||
* [PHP Manual: Multibyte String Functions](http://php.net/ref.mbstring)
|
||||
* [`mb_strpos()`](http://php.net/function.mb-strpos)
|
||||
* [`mb_strlen()`](http://php.net/function.mb-strlen)
|
||||
* [`mb_substr()`](http://php.net/function.mb-substr)
|
||||
* [`mb_internal_encoding()`](http://php.net/function.mb-internal-encoding)
|
||||
* [`mb_http_output()`](http://php.net/function.mb-http-output)
|
||||
* [`htmlentities()`](http://php.net/function.htmlentities)
|
||||
* [`htmlspecialchars()`](http://php.net/function.htmlspecialchars)
|
||||
* [PHP UTF-8 Cheatsheet](http://blog.loftdigital.com/blog/php-utf-8-cheatsheet)
|
||||
* [Stack Overflow: What factors make PHP Unicode-incompatible?](http://stackoverflow.com/questions/571694/what-factors-make-php-unicode-incompatible)
|
||||
* [Stack Overflow: Best practices in PHP and MySQL with international strings](http://stackoverflow.com/questions/140728/best-practices-in-php-and-mysql-with-international-strings)
|
||||
|
@@ -23,7 +23,7 @@ rushed later on.
|
||||
|
||||
**If you are starting from scratch then absolutely do not use the [mysql] extension: use the [MySQLi extension][mysqli], or use [PDO].**
|
||||
|
||||
* [PHP: Choosing an API for MySQL](http://php.net/manual/en/mysqlinfo.api.choosing.php)
|
||||
* [PHP: Choosing an API for MySQL](http://php.net/mysqlinfo.api.choosing)
|
||||
* [PDO Tutorial for MySQL Developers](http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers)
|
||||
|
||||
## PDO Extension
|
||||
@@ -87,9 +87,9 @@ unless of course you are using persistent connections.
|
||||
|
||||
* [Learn about PDO connections]
|
||||
|
||||
[Learn about PDO]: http://www.php.net/manual/en/book.pdo.php
|
||||
[Learn about PDO connections]: http://php.net/manual/en/pdo.connections.php
|
||||
[officially deprecated as of PHP 5.5.0]: http://php.net/manual/en/migration55.deprecated.php
|
||||
[Learn about PDO]: http://php.net/book.pdo
|
||||
[Learn about PDO connections]: http://php.net/pdo.connections
|
||||
[officially deprecated as of PHP 5.5.0]: http://php.net/migration55.deprecated
|
||||
[SQL Injection]: http://wiki.hashphp.org/Validation
|
||||
|
||||
[pdo]: http://php.net/pdo
|
||||
|
@@ -18,7 +18,7 @@ Some abstraction layers have been built using the [PSR-0][psr0] or [PSR-4][psr4]
|
||||
* [Propel][7]
|
||||
* [ZF2 Db][4]
|
||||
|
||||
[1]: http://www.php.net/manual/en/book.pdo.php
|
||||
[1]: http://php.net/book.pdo
|
||||
[2]: http://www.doctrine-project.org/projects/dbal.html
|
||||
[4]: http://packages.zendframework.com/docs/latest/manual/en/index.html#zend-db
|
||||
[6]: https://github.com/auraphp/Aura.Sql
|
||||
|
@@ -1,4 +1,4 @@
|
||||
---
|
||||
---
|
||||
isChild: true
|
||||
anchor: errors
|
||||
---
|
||||
@@ -99,13 +99,13 @@ The "[Scream]" PHP extension offers similar functionality to xDebug's, although
|
||||
This is most useful when you're debugging code and suspect an informative error is suppressed. Use scream with care, and as a temporary debugging tool. There's lots of PHP library code that may not work with the error control operator disabled.
|
||||
|
||||
|
||||
* [Error Control Operators](http://php.net/manual/en/language.operators.errorcontrol.php)
|
||||
* [Error Control Operators](http://php.net/language.operators.errorcontrol)
|
||||
* [SitePoint](http://www.sitepoint.com/)
|
||||
* [xDebug]
|
||||
* [Scream]
|
||||
|
||||
[xDebug]: http://xdebug.org/docs/basic
|
||||
[Scream]: http://www.php.net/manual/en/book.scream.php
|
||||
[Scream]: http://php.net/book.scream
|
||||
|
||||
### ErrorException
|
||||
|
||||
@@ -122,11 +122,11 @@ exception during development you can wrap it in a catch statement with specific
|
||||
More information on this and details on how to use `ErrorException` with error handling can be found at
|
||||
[ErrorException Class][errorexception].
|
||||
|
||||
* [Error Control Operators](http://php.net/manual/en/language.operators.errorcontrol.php)
|
||||
* [Predefined Constants for Error Handling](http://www.php.net/manual/en/errorfunc.constants.php)
|
||||
* [error_reporting](http://www.php.net/manual/en/function.error-reporting.php)
|
||||
* [Error Control Operators](http://php.net/language.operators.errorcontrol)
|
||||
* [Predefined Constants for Error Handling](http://php.net/errorfunc.constants)
|
||||
* [error_reporting](http://php.net/function.error-reporting)
|
||||
* [Reporting][errorreport]
|
||||
|
||||
[errorexception]: http://php.net/manual/en/class.errorexception.php
|
||||
[errorexception]: http://php.net/class.errorexception
|
||||
[errorreport]: /#error_reporting
|
||||
[Whoops!]: http://filp.github.io/whoops/
|
||||
|
@@ -67,8 +67,8 @@ Exception which is vague, or creating a custom Exception just for that, you coul
|
||||
* [Nesting Exceptions In PHP][nesting-exceptions-in-php]
|
||||
* [Exception Best Practices in PHP 5.3][exception-best-practices53]
|
||||
|
||||
[exceptions]: http://php.net/manual/en/language.exceptions.php
|
||||
[splexe]: http://php.net/manual/en/spl.exceptions.php
|
||||
[exceptions]: http://php.net/language.exceptions
|
||||
[splexe]: http://php.net/spl.exceptions
|
||||
[splext]: /#standard_php_library
|
||||
[exception-best-practices53]: http://ralphschindler.com/2010/09/15/exception-best-practices-in-php-5-3
|
||||
[nesting-exceptions-in-php]: http://www.brandonsavage.net/exceptional-php-nesting-exceptions-in-php/
|
||||
|
@@ -36,7 +36,7 @@ if (password_verify('bad-password', $passwordHash)) {
|
||||
* [Learn about hashing in regards to cryptography] [3]
|
||||
* [PHP `password_hash` RFC] [4]
|
||||
|
||||
[1]: http://us2.php.net/manual/en/function.password-hash.php
|
||||
[1]: http://php.net/function.password-hash
|
||||
[2]: https://github.com/ircmaxell/password_compat
|
||||
[3]: http://en.wikipedia.org/wiki/Cryptographic_hash_function
|
||||
[4]: https://wiki.php.net/rfc/password_hash
|
||||
|
@@ -60,10 +60,10 @@ email address, a phone number, or age when processing a registration submission.
|
||||
|
||||
[See Validation Filters][3]
|
||||
|
||||
[1]: http://www.php.net/manual/en/book.filter.php
|
||||
[2]: http://www.php.net/manual/en/filter.filters.sanitize.php
|
||||
[3]: http://www.php.net/manual/en/filter.filters.validate.php
|
||||
[4]: http://php.net/manual/en/function.filter-var.php
|
||||
[5]: http://www.php.net/manual/en/function.filter-input.php
|
||||
[6]: http://php.net/manual/en/security.filesystem.nullbytes.php
|
||||
[1]: http://php.net/book.filter
|
||||
[2]: http://php.net/filter.filters.sanitize
|
||||
[3]: http://php.net/filter.filters.validate
|
||||
[4]: http://php.net/function.filter-var
|
||||
[5]: http://php.net/function.filter-input
|
||||
[6]: http://php.net/security.filesystem.nullbytes
|
||||
[html-purifier]: http://htmlpurifier.org/
|
||||
|
@@ -15,4 +15,4 @@ security issues as your application cannot effectively tell where the data is co
|
||||
For example: `$_GET['foo']` would be available via `$foo`, which can override variables that have not been declared.
|
||||
If you are using PHP < 5.4.0 __make sure__ that `register_globals` is __off__.
|
||||
|
||||
* [Register_globals in the PHP manual](http://www.php.net/manual/en/security.globals.php)
|
||||
* [Register_globals in the PHP manual](http://php.net/security.globals)
|
||||
|
@@ -19,7 +19,7 @@ To show every possible error during <strong>development</strong>, configure the
|
||||
error_reporting = -1
|
||||
log_errors = On
|
||||
|
||||
> Passing in the value `-1` will show every possible error, even when new levels and constants are added in future PHP versions. The `E_ALL` constant also behaves this way as of PHP 5.4. - [php.net](http://php.net/manual/function.error-reporting.php)
|
||||
> Passing in the value `-1` will show every possible error, even when new levels and constants are added in future PHP versions. The `E_ALL` constant also behaves this way as of PHP 5.4. - [php.net](http://php.net/function.error-reporting)
|
||||
|
||||
The `E_STRICT` error level constant was introduced in 5.3.0 and is not
|
||||
part of `E_ALL`, however it became part of `E_ALL` in 5.4.0. What does this mean?
|
||||
@@ -44,7 +44,7 @@ To hide errors on your <strong>production</strong> environment, configure your `
|
||||
With these settings in production, errors will still be logged to the error logs for the web server, but will not be
|
||||
shown to the user. For more information on these settings, see the PHP manual:
|
||||
|
||||
* [error_reporting](http://php.net/manual/errorfunc.configuration.php#ini.error-reporting)
|
||||
* [display_errors](http://php.net/manual/errorfunc.configuration.php#ini.display-errors)
|
||||
* [display_startup_errors](http://php.net/manual/errorfunc.configuration.php#ini.display-startup-errors)
|
||||
* [log_errors](http://php.net/manual/errorfunc.configuration.php#ini.log-errors)
|
||||
* [error_reporting](http://php.net/errorfunc.configuration#ini.error-reporting)
|
||||
* [display_errors](http://php.net/errorfunc.configuration#ini.display-errors)
|
||||
* [display_startup_errors](http://php.net/errorfunc.configuration#ini.display-startup-errors)
|
||||
* [log_errors](http://php.net/errorfunc.configuration#ini.log-errors)
|
||||
|
@@ -12,7 +12,7 @@ If you are comfortable with systems administration, or are interested in learnin
|
||||
PHP, via PHP's built-in FastCGI Process Manager (FPM), pairs really nicely with [nginx](http://nginx.org), which is a lightweight, high-performance web server. It uses less memory than Apache and can better handle more concurrent requests. This is especially important on virtual servers that don't have much memory to spare.
|
||||
|
||||
* [Read more on nginx](http://nginx.org)
|
||||
* [Read more on PHP-FPM](http://php.net/manual/en/install.fpm.php)
|
||||
* [Read more on PHP-FPM](http://php.net/install.fpm)
|
||||
* [Read more on setting up nginx and PHP-FPM securely](https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration/)
|
||||
|
||||
### Apache and PHP
|
||||
|
@@ -5,4 +5,4 @@ anchor: caching
|
||||
# Caching {#caching_title}
|
||||
|
||||
PHP is pretty quick by itself, but bottlenecks can arise when you make remote connections, load files, etc.
|
||||
Thankfully, there are various tools available to speed up certain parts of your application, or reduce the number of times these various time-consuming tasks need to run.
|
||||
Thankfully, there are various tools available to speed up certain parts of your application, or reduce the number of times these various time-consuming tasks need to run.
|
||||
|
@@ -16,10 +16,10 @@ As of PHP 5.5, there is a built-in opcode cache called [OPcache][opcache-book].
|
||||
Read more about opcode caches:
|
||||
|
||||
* [OPcache][opcache-book] (built-in since PHP 5.5)
|
||||
* [APC](http://php.net/manual/en/book.apc.php) (PHP 5.4 and earlier)
|
||||
* [APC](http://php.net/book.apc) (PHP 5.4 and earlier)
|
||||
* [XCache](http://xcache.lighttpd.net/)
|
||||
* [Zend Optimizer+](http://www.zend.com/products/server/) (part of Zend Server package)
|
||||
* [WinCache](http://www.iis.net/download/wincacheforphp) (extension for MS Windows Server)
|
||||
* [list of PHP accelerators on Wikipedia](http://en.wikipedia.org/wiki/List_of_PHP_accelerators)
|
||||
|
||||
[opcache-book]: http://php.net/manual/en/book.opcache.php
|
||||
[opcache-book]: http://php.net/book.opcache
|
||||
|
@@ -48,8 +48,8 @@ object cache to PHP 5.5+, since PHP now has a built-in bytecode cache (OPcache).
|
||||
Learn more about popular object caching systems:
|
||||
|
||||
* [APCu](https://github.com/krakjoe/apcu)
|
||||
* [APC Functions](http://php.net/manual/en/ref.apc.php)
|
||||
* [APC Functions](http://php.net/ref.apc)
|
||||
* [Memcached](http://memcached.org/)
|
||||
* [Redis](http://redis.io/)
|
||||
* [XCache APIs](http://xcache.lighttpd.net/wiki/XcacheApi)
|
||||
* [WinCache Functions](http://www.php.net/manual/en/ref.wincache.php)
|
||||
* [WinCache Functions](http://php.net/ref.wincache)
|
||||
|
@@ -20,7 +20,7 @@ The PHP community also hosts larger regional and national conferences in many co
|
||||
|
||||
[Find a PHP Conference][php-conf]
|
||||
|
||||
[php-calendar]: http://www.php.net/cal.php
|
||||
[php-calendar]: http://php.net/cal.php
|
||||
[google]: https://www.google.com/search?q=php+user+group+near+me
|
||||
[meetup]: http://www.meetup.com/find/
|
||||
[php-ug]: http://php.ug
|
||||
|
@@ -196,7 +196,7 @@ add new output types without affecting the client code.
|
||||
|
||||
You will see how each concrete 'output' class implements an OutputInterface - this serves two purposes, primarily it
|
||||
provides a simple contract which must be obeyed by any new concrete implementations. Secondly by implementing a common
|
||||
interface you will see in the next section that you can now utilise [Type Hinting](http://php.net/manual/en/language.oop5.typehinting.php) to ensure that the client which is utilising these behaviours is of the correct type in
|
||||
interface you will see in the next section that you can now utilise [Type Hinting](http://php.net/language.oop5.typehinting) to ensure that the client which is utilising these behaviours is of the correct type in
|
||||
this case 'OutputInterface'.
|
||||
|
||||
The next snippet of code outlines how a calling client class might use one of these algorithms and even better set the
|
||||
|
@@ -82,6 +82,6 @@ defined to capture variables in scope and access them later when the anonymous f
|
||||
* [More details in the Closures RFC][closures-rfc]
|
||||
* [Read about dynamically invoking functions with `call_user_func_array`][call-user-func-array]
|
||||
|
||||
[anonymous-functions]: http://www.php.net/manual/en/functions.anonymous.php
|
||||
[call-user-func-array]: http://php.net/manual/en/function.call-user-func-array.php
|
||||
[anonymous-functions]: http://php.net/functions.anonymous
|
||||
[call-user-func-array]: http://php.net/function.call-user-func-array
|
||||
[closures-rfc]: https://wiki.php.net/rfc/closures
|
||||
|
@@ -33,8 +33,8 @@ if (strpos('testing', 'test') !== false) { // true, as strict comparison was
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
* [Comparison operators](http://php.net/manual/en/language.operators.comparison.php)
|
||||
* [Comparison table](http://php.net/manual/en/types.comparisons.php)
|
||||
* [Comparison operators](http://php.net/language.operators.comparison)
|
||||
* [Comparison table](http://php.net/types.comparisons)
|
||||
|
||||
## Conditional statements
|
||||
|
||||
@@ -66,7 +66,7 @@ function test($a)
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
* [If statements](http://php.net/manual/en/control-structures.if.php)
|
||||
* [If statements](http://php.net/control-structures.if)
|
||||
|
||||
### Switch statements
|
||||
|
||||
@@ -99,7 +99,7 @@ function test($a)
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
* [Switch statements](http://php.net/manual/en/control-structures.switch.php)
|
||||
* [Switch statements](http://php.net/control-structures.switch)
|
||||
* [PHP switch](http://phpswitch.com/)
|
||||
|
||||
## Global namespace
|
||||
@@ -124,8 +124,8 @@ function array()
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
* [Global space](http://php.net/manual/en/language.namespaces.global.php)
|
||||
* [Global rules](http://php.net/manual/en/userlandnaming.rules.php)
|
||||
* [Global space](http://php.net/language.namespaces.global)
|
||||
* [Global rules](http://php.net/userlandnaming.rules)
|
||||
|
||||
## Strings
|
||||
|
||||
@@ -149,7 +149,7 @@ $a = 'Multi-line example' // concatenation operator (.)
|
||||
. 'of what to do';
|
||||
{% endhighlight %}
|
||||
|
||||
* [String Operators](http://php.net/manual/en/language.operators.string.php)
|
||||
* [String Operators](http://php.net/language.operators.string)
|
||||
|
||||
### String types
|
||||
|
||||
@@ -177,7 +177,7 @@ echo 'This is my string, look at how pretty it is.'; // no need to parse a si
|
||||
*/
|
||||
{% endhighlight %}
|
||||
|
||||
* [Single quote](http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single)
|
||||
* [Single quote](http://php.net/language.types.string#language.types.string.syntax.single)
|
||||
|
||||
#### Double quotes
|
||||
|
||||
@@ -227,7 +227,7 @@ $juice = array('apple', 'orange', 'plum');
|
||||
echo "I drank some juice made of {$juice[1]}s"; // $juice[1] will be parsed
|
||||
{% endhighlight %}
|
||||
|
||||
* [Double quotes](http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double)
|
||||
* [Double quotes](http://php.net/language.types.string#language.types.string.syntax.double)
|
||||
|
||||
#### Nowdoc syntax
|
||||
|
||||
@@ -253,7 +253,7 @@ EOD; // closing 'EOD' must be on it's own line, and to th
|
||||
*/
|
||||
{% endhighlight %}
|
||||
|
||||
* [Nowdoc syntax](http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc)
|
||||
* [Nowdoc syntax](http://php.net/language.types.string#language.types.string.syntax.nowdoc)
|
||||
|
||||
#### Heredoc syntax
|
||||
|
||||
@@ -281,7 +281,7 @@ EOD; // closing 'EOD' must be on it's own line, and to th
|
||||
*/
|
||||
{% endhighlight %}
|
||||
|
||||
* [Heredoc syntax](http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc)
|
||||
* [Heredoc syntax](http://php.net/language.types.string#language.types.string.syntax.heredoc)
|
||||
|
||||
### Which is quicker?
|
||||
|
||||
@@ -380,7 +380,7 @@ Another example is the snippet below which will return true if ($a != 3 AND $b !
|
||||
return ($a != 3 && $b != 4) || $c == 5;
|
||||
{% endhighlight %}
|
||||
|
||||
* [Ternary operators](http://php.net/manual/en/language.operators.comparison.php)
|
||||
* [Ternary operators](http://php.net/language.operators.comparison)
|
||||
|
||||
## Variable declarations
|
||||
|
||||
|
Reference in New Issue
Block a user