You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/03-02-01-Programming-Paradigms.md
+19-1
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,9 @@ isChild: true
4
4
5
5
## Programming Paradigms
6
6
7
-
PHP is a flexible, dynamic language that supports a variety of programming techniques. It has evolved dramatically over the years, notably adding a solid object-oriented model in PHP 5.0 (2004), anonymous functions and namespaces in PHP 5.3 (2009), and traits in PHP 5.4 (2012).
7
+
PHP is a flexible, dynamic language that supports a variety of programming techniques. It has evolved dramatically over the years,
8
+
notably adding a solid object-oriented model in PHP 5.0 (2004), anonymous functions and namespaces in PHP 5.3 (2009), and traits in
9
+
PHP 5.4 (2012).
8
10
9
11
### Object-oriented Programming
10
12
@@ -13,15 +15,31 @@ PHP is a flexible, dynamic language that supports a variety of programming techn
13
15
14
16
### Functional Programming
15
17
18
+
PHP has had annonymous functions since PHP 5.3:
19
+
20
+
{% highlight php %}
21
+
<?php
22
+
$greet = function($name)
23
+
{
24
+
print("Hello {$name}");
25
+
};
26
+
27
+
$greet('World');
28
+
{% endhighlight %}
29
+
16
30
* [Read about Anonymous functions][anonymous-functions]
17
31
* [Read about dynamically invoking functions with `call_user_func_array`][call-user-func-array]
18
32
19
33
### Meta Programming
20
34
35
+
Ruby developers often say that PHP is lacking `method_missing`, but it is available as `__call()`. There are many Magic Methods available
36
+
like `__get()`, `__set()`, `__clone()`, `__toString()`, etc.
0 commit comments