From b307b65e8df4e27991c8cf7ade1e3d7faa1e87fd Mon Sep 17 00:00:00 2001
From: Anton Ivanov <sendmailn@gmail.com>
Date: Sat, 31 Oct 2015 14:37:12 +0300
Subject: Add binary number example.

---
 php.html.markdown | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'php.html.markdown')

diff --git a/php.html.markdown b/php.html.markdown
index 7b0cf61c..d03b89fe 100644
--- a/php.html.markdown
+++ b/php.html.markdown
@@ -54,6 +54,8 @@ $int1 = 12;   // => 12
 $int2 = -12;  // => -12
 $int3 = 012;  // => 10 (a leading 0 denotes an octal number)
 $int4 = 0x0F; // => 15 (a leading 0x denotes a hex literal)
+// Binary integer literals are available since PHP 5.4.0.
+$int5 = 0b11111111; // 255 (a leading 0b denotes a binary number)
 
 // Floats (aka doubles)
 $float = 1.234;
@@ -117,11 +119,11 @@ echo 'Multiple', 'Parameters', 'Valid';  // Returns 'MultipleParametersValid'
 
 // a valid constant name starts with a letter or underscore,
 // followed by any number of letters, numbers, or underscores.
-define("FOO",     "something");
+define("FOO", "something");
 
 // access to a constant is possible by calling the choosen name without a $
 echo FOO; // Returns 'something'
-echo 'This outputs '.FOO;  // Returns 'This ouputs something'
+echo 'This outputs ' . FOO;  // Returns 'This ouputs something'
 
 
 
-- 
cgit v1.2.3


From db690c17c5335b746e3e7867e3d7cf5aab724a9a Mon Sep 17 00:00:00 2001
From: Rudy Affandi <rudy@adnetinc.com>
Date: Sat, 31 Oct 2015 10:54:55 -0700
Subject: Add PHP magic constants entry

---
 php.html.markdown | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'php.html.markdown')

diff --git a/php.html.markdown b/php.html.markdown
index 0504ced2..06a289f4 100644
--- a/php.html.markdown
+++ b/php.html.markdown
@@ -765,6 +765,13 @@ I'm a ParentClass
 But I'm ChildClass
 */
 
+/**********************
+*  Magic constants
+*  
+*/
+
+// Get directory of the file
+require __DIR__ . '/vendor/autoload.php';
 
 /**********************
 *  Error Handling
-- 
cgit v1.2.3


From dc1c759c2903f15fd3c52c2241c765c65fbe9d89 Mon Sep 17 00:00:00 2001
From: Rudy Affandi <rudy@adnetinc.com>
Date: Sat, 31 Oct 2015 11:27:13 -0700
Subject: Add the rest of the magic constants

---
 php.html.markdown | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

(limited to 'php.html.markdown')

diff --git a/php.html.markdown b/php.html.markdown
index 06a289f4..5034cfd1 100644
--- a/php.html.markdown
+++ b/php.html.markdown
@@ -770,8 +770,32 @@ But I'm ChildClass
 *  
 */
 
-// Get directory of the file
-require __DIR__ . '/vendor/autoload.php';
+// Get current class name. Must be used inside a class declaration.
+echo "Current class name is " . __CLASS__;
+
+// Get full path directory of a file
+echo "Current directory is " . __DIR__;
+
+    // Typical usage
+    require __DIR__ . '/vendor/autoload.php';
+
+// Get full path of a file
+echo "Current file path is " . __FILE__;
+
+// Get current function name
+echo "Current function name is " . __FUNCTION__;
+
+// Get current line number
+echo "Current line number is " . __LINE__;
+
+// Get the name of the current method. Only returns a value when used inside a trait or object declaration.
+echo "Current method is " . __METHOD__;
+
+// Get the name of the current namespace
+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__;
 
 /**********************
 *  Error Handling
-- 
cgit v1.2.3