From ebc70fe2897cd8fddcde60299fb4fd9b0aae5150 Mon Sep 17 00:00:00 2001 From: Chung-Ping Huang Date: Wed, 16 Nov 2016 14:49:32 +0800 Subject: Add a missing semi-colon (#2572) Add a missing semi-colon at Line 470 --- php.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'php.html.markdown') diff --git a/php.html.markdown b/php.html.markdown index 82d27546..c8e73987 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -467,7 +467,7 @@ function variable($word, ...$list) { } } -variable("Separate", "Hello", "World") // Separate || Hello | World | +variable("Separate", "Hello", "World"); // Separate || Hello | World | /******************************** * Includes -- cgit v1.2.3 From 7c16ec5ae15ca3d29354179b33f290fb439f434c Mon Sep 17 00:00:00 2001 From: Badal Surana Date: Sat, 3 Dec 2016 16:16:23 +0530 Subject: [php/en] Fix typo (#2590) --- php.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'php.html.markdown') diff --git a/php.html.markdown b/php.html.markdown index c8e73987..ddf38226 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -824,7 +824,7 @@ echo "Current method is " . __METHOD__; echo "Current namespace is " . __NAMESPACE__; // Get the name of the current trait. Only returns a value when used inside a trait or object declaration. -echo "Current namespace is " . __TRAIT__; +echo "Current trait is " . __TRAIT__; /********************** * Error Handling -- cgit v1.2.3 From 34b6b504fa30f8c344ac111ea7474e336136f5c4 Mon Sep 17 00:00:00 2001 From: Yerkebulan Tulibergenov Date: Fri, 16 Jun 2017 00:40:47 -0700 Subject: [PHP/en]Fix small typo in PHP English tutorial (#2761) --- php.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'php.html.markdown') diff --git a/php.html.markdown b/php.html.markdown index ddf38226..f247ba77 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -342,7 +342,7 @@ switch ($x) { $i = 0; while ($i < 5) { echo $i++; -}; // Prints "01234" +} // Prints "01234" echo "\n"; -- cgit v1.2.3 From c4b9f335491d7393860f5ac14bcf2b9e70db498b Mon Sep 17 00:00:00 2001 From: avimar Date: Fri, 11 Aug 2017 06:43:33 +0300 Subject: php: fix double language for arrays --- php.html.markdown | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'php.html.markdown') diff --git a/php.html.markdown b/php.html.markdown index f247ba77..ac9b45a8 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -132,9 +132,7 @@ echo 'This outputs ' . FOO; // Returns 'This ouputs something' * Arrays */ -// All arrays in PHP are associative arrays (hashmaps), - -// Associative arrays, known as hashmaps in some languages. +// All arrays in PHP are associative arrays (hashmaps in some languages) // Works with all PHP versions $associative = array('One' => 1, 'Two' => 2, 'Three' => 3); -- cgit v1.2.3 From 985d23a52b76593a120adff5381c2df3a80fe298 Mon Sep 17 00:00:00 2001 From: HairyFotr Date: Wed, 23 Aug 2017 10:14:39 +0200 Subject: Fix a bunch of typos --- php.html.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'php.html.markdown') diff --git a/php.html.markdown b/php.html.markdown index ac9b45a8..f82cea7d 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -122,9 +122,9 @@ echo 'Multiple', 'Parameters', 'Valid'; // Returns 'MultipleParametersValid' // followed by any number of letters, numbers, or underscores. define("FOO", "something"); -// access to a constant is possible by calling the choosen name without a $ +// access to a constant is possible by calling the chosen name without a $ echo FOO; // Returns 'something' -echo 'This outputs ' . FOO; // Returns 'This ouputs something' +echo 'This outputs ' . FOO; // Returns 'This outputs something' @@ -837,7 +837,7 @@ try { // Handle exception } -// When using try catch blocks in a namespaced enviroment use the following +// When using try catch blocks in a namespaced environment use the following try { // Do something @@ -854,7 +854,7 @@ try { $condition = true; if ($condition) { - throw new MyException('Something just happend'); + throw new MyException('Something just happened'); } } catch (MyException $e) { -- cgit v1.2.3 From 973883c57cef5caa01e60856fbd0884fff26809c Mon Sep 17 00:00:00 2001 From: Michael Hirschler Date: Sun, 3 Dec 2017 11:23:03 +0100 Subject: unifies namespace variants in exception handling --- php.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'php.html.markdown') diff --git a/php.html.markdown b/php.html.markdown index f82cea7d..d4fbaa32 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -841,7 +841,7 @@ try { try { // Do something -} catch (\Exception $e) { +} catch (Exception $e) { // Handle exception } -- cgit v1.2.3 From 9f337dd02823f845ca913beb44464f269340c7dd Mon Sep 17 00:00:00 2001 From: Rahiel Kasim Date: Mon, 1 Oct 2018 09:53:22 +0200 Subject: [php/en]: typo --- php.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'php.html.markdown') diff --git a/php.html.markdown b/php.html.markdown index d4fbaa32..6542035f 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) { -- cgit v1.2.3 From 00c12ddcff858b9e7bfe450bd4d4b492206a3b34 Mon Sep 17 00:00:00 2001 From: Apoorv Choubey Date: Thu, 11 Oct 2018 21:41:42 +0530 Subject: add PHP resource --- php.html.markdown | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'php.html.markdown') diff --git a/php.html.markdown b/php.html.markdown index 6542035f..3b18aa60 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -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 @@ -871,6 +871,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/). -- cgit v1.2.3 From ca98611c099b2108c37c603440338d1b7ba6cdfb Mon Sep 17 00:00:00 2001 From: Divay Prakash Date: Fri, 2 Nov 2018 04:21:54 +0530 Subject: Fix exception handling example --- php.html.markdown | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'php.html.markdown') diff --git a/php.html.markdown b/php.html.markdown index 3b18aa60..40c9dd01 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -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 } -- cgit v1.2.3 From dc7996c6e84f38a1cbb7e268c69275c7f19b792a Mon Sep 17 00:00:00 2001 From: Suhayb Alghutaymil Date: Wed, 22 Jan 2020 13:49:33 +0300 Subject: Remove an extra double quote --- php.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'php.html.markdown') diff --git a/php.html.markdown b/php.html.markdown index 40c9dd01..d4103e97 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -289,7 +289,7 @@ if (false) { print (false ? 'Does not get printed' : 'Does'); // ternary shortcut operator since PHP 5.3 -// equivalent of "$x ? $x : 'Does'"" +// equivalent of "$x ? $x : 'Does'" $x = false; print($x ?: 'Does'); -- cgit v1.2.3 From ea3d958179d0da54e2795733b782962f60662750 Mon Sep 17 00:00:00 2001 From: Alexar Date: Sat, 30 May 2020 05:02:34 +1000 Subject: Explains the weird behavior of PHP tag in a PHP script --- php.html.markdown | 1 + 1 file changed, 1 insertion(+) (limited to 'php.html.markdown') diff --git a/php.html.markdown b/php.html.markdown index d4103e97..96f30875 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -34,6 +34,7 @@ echo "World\n"; // Prints "World" with a line break ?> Hello World Again! Date: Sat, 30 May 2020 05:10:55 +1000 Subject: Explains variable declaration plus a minor improvement --- php.html.markdown | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'php.html.markdown') diff --git a/php.html.markdown b/php.html.markdown index d4103e97..e1411085 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -41,12 +41,15 @@ Hello World Again! */ // Variables begin with the $ symbol. -// A valid variable name starts with a letter or underscore, +// A valid variable name starts with a letter or an underscore, // followed by any number of letters, numbers, or underscores. +// You don't have to (and cannot) declare variables. +// Once you assign a value, PHP will create the variable with the right type. + // Boolean values are case-insensitive $boolean = true; // or TRUE or True -$boolean = false; // or FALSE or False +$boolean = FALSE; // or false or False // Integers $int1 = 12; // => 12 -- cgit v1.2.3