of TechAnalyze.io Author of PHP|Architect's "Mastering the SPL" Blog: http://adayinthelifeof.nl Email: [email protected] Twitter: @jaytaph dinsdag 9 september 14
const ONE = 1; 6 7 const LINE_ONE = "This is a line " . self::ONE; 8 } 1 ?php 2 3 class D 4 { 5 const ONE = 1; 6 } 7 class C 8 { 9 const THREE = D::ONE + 2; 10 } Different constant scalar expression examples dinsdag 9 september 14
bar($namespace) { 6 print "This is " . __FUNCTION__ . ", and called from namespace ". $namespace. "\n"; 7 } 8 9 namespace Another\Name; 10 11 use function Foo\bar; 12 13 bar(__NAMESPACE__); // Calls the Foo\bar() method Use function dinsdag 9 september 14
bar($namespace) { 6 print "This is " . __FUNCTION__ . ", and called from namespace ". $namespace. "\n"; 7 } 8 9 namespace Another\Name; 10 11 use function Foo\bar; 12 13 bar(__NAMESPACE__); // Calls the Foo\bar() method Use function This is Foo\bar, and called from namespace Another\Name dinsdag 9 september 14
bar($namespace) { 6 print "This is " . __FUNCTION__ . ", and called from namespace ". $namespace. "\n"; 7 } 8 9 namespace Another\Name; 10 11 use function Foo\bar as foobar; 12 13 foobar(__NAMESPACE__); // Calls the Foo\bar() method Use function with aliasing dinsdag 9 september 14
bar($namespace) { 6 print "This is " . __FUNCTION__ . ", and called from namespace ". $namespace. "\n"; 7 } 8 9 namespace Another\Name; 10 11 use function Foo\bar as foobar; 12 13 foobar(__NAMESPACE__); // Calls the Foo\bar() method Use function with aliasing This is Foo\bar, and called from namespace Another\Name dinsdag 9 september 14
bar($namespace) { 6 print "This is " . __FUNCTION__ . ", and called from namespace ". $namespace. "\n"; 7 } 8 9 namespace Another\Name; 10 11 use function Foo\bar; 12 13 // Can be defined without any problems 14 function bar() { 15 print "Bar!"; 16 } 17 18 bar(__NAMESPACE__); // Calls the Foo\bar() method 19 20 \Another\Name\bar(); // Calls our own bar() method Multiple function defines dinsdag 9 september 14
bar($namespace) { 6 print "This is " . __FUNCTION__ . ", and called from namespace ". $namespace. "\n"; 7 } 8 9 namespace Another\Name; 10 11 use function Foo\bar; 12 13 // Can be defined without any problems 14 function bar() { 15 print "Bar!"; 16 } 17 18 bar(__NAMESPACE__); // Calls the Foo\bar() method 19 20 \Another\Name\bar(); // Calls our own bar() method Multiple function defines This is Foo\bar, and called from namespace Another\Name Bar! dinsdag 9 september 14
and training: www.noxlogic.nl Find me on email: [email protected] Find me for blogs: www.adayinthelifeof.nl Thanks for your attention https://joind.in/event/view/2584 Please leave feedback at dinsdag 9 september 14