diff options
author | woclass <inkydragon@users.noreply.github.com> | 2018-12-03 20:30:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-03 20:30:45 +0800 |
commit | cd7816a2be62b0dcd2aca181d1aadd68b8e4d5d7 (patch) | |
tree | f75c300c92d40e29bf59f83775aec019b45e56e7 /php.html.markdown | |
parent | 440247a59706603bd980016821ecd6a72a6182d1 (diff) | |
parent | 1fd955ae6479650b987a54a93b09507bfdf06954 (diff) |
Merge pull request #1 from adambard/master
Update from Upstream
Diffstat (limited to 'php.html.markdown')
-rw-r--r-- | php.html.markdown | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/php.html.markdown b/php.html.markdown index d4fbaa32..40c9dd01 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -443,7 +443,7 @@ echo $function_name(1, 2); // => 3 // Or, use call_user_func(callable $callback [, $parameter [, ... ]]); -// You can get the all the parameters passed to a function +// You can get all the parameters passed to a function function parameters() { $numargs = func_num_args(); if ($numargs > 0) { @@ -794,7 +794,7 @@ But I'm ChildClass /********************** * Magic constants -* +* */ // Get current class name. Must be used inside a class declaration. @@ -826,7 +826,7 @@ echo "Current trait is " . __TRAIT__; /********************** * Error Handling -* +* */ // Simple error handling can be done with try catch block @@ -837,11 +837,14 @@ try { // Handle exception } -// When using try catch blocks in a namespaced environment use the following +// When using try catch blocks in a namespaced environment it is important to +// escape to the global namespace, because Exceptions are classes, and the +// Exception class exists in the global namespace. This can be done using a +// leading backslash to catch the Exception. try { // Do something -} catch (Exception $e) { +} catch (\Exception $e) { // Handle exception } @@ -871,6 +874,9 @@ and community input. If you're interested in up-to-date best practices, visit [PHP The Right Way](http://www.phptherightway.com/). +A tutorial covering basics of language, setting up coding environment and making +few practical projects at [Codecourse - PHP Basics](https://www.youtube.com/playlist?list=PLfdtiltiRHWHjTPiFDRdTOPtSyYfz3iLW). + If you're coming from a language with good package management, check out [Composer](http://getcomposer.org/). |