Skip to content

Commit 31b6ff7

Browse files
authored
is-callable.xml Remove extra dot in refpurpose, examples nits (#4092)
1 parent ce3a6b0 commit 31b6ff7

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

reference/var/functions/is-callable.xml

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<refnamediv>
55
<refname>is_callable</refname>
66
<refpurpose>
7-
Verify that a value can be called as a function from the current scope.
7+
Verify that a value can be called as a function from the current scope
88
</refpurpose>
99
</refnamediv>
1010

@@ -77,42 +77,37 @@
7777
<programlisting role="php">
7878
<![CDATA[
7979
<?php
80-
// How to check a variable to see if it can be called
81-
// as a function.
80+
// How to check a variable to see if it can be called
81+
// as a function.
8282
8383
//
84-
// Simple variable containing a function
84+
// Simple variable containing a function
8585
//
8686
87-
function someFunction()
88-
{
89-
}
87+
function someFunction() {}
9088
9189
$functionVariable = 'someFunction';
9290
93-
var_dump(is_callable($functionVariable, false, $callable_name)); // bool(true)
91+
var_dump(is_callable($functionVariable, false, $callable_name)); // bool(true)
9492
95-
echo $callable_name, "\n"; // someFunction
93+
echo $callable_name, "\n"; // someFunction
9694
9795
//
98-
// Array containing a method
96+
// Array containing a method
9997
//
10098
101-
class someClass {
102-
103-
function someMethod()
104-
{
105-
}
106-
99+
class someClass
100+
{
101+
public function someMethod() {}
107102
}
108103
109104
$anObject = new someClass();
110105
111-
$methodVariable = array($anObject, 'someMethod');
106+
$methodVariable = [$anObject, 'someMethod'];
112107
113-
var_dump(is_callable($methodVariable, true, $callable_name)); // bool(true)
108+
var_dump(is_callable($methodVariable, true, $callable_name)); // bool(true)
114109
115-
echo $callable_name, "\n"; // someClass::someMethod
110+
echo $callable_name, "\n"; // someClass::someMethod
116111
117112
?>
118113
]]>
@@ -131,13 +126,16 @@ echo $callable_name, "\n"; // someClass::someMethod
131126
class Foo
132127
{
133128
public function __construct() {}
129+
134130
public function foo() {}
135131
}
136132
137133
var_dump(
138-
is_callable(array('Foo', '__construct')),
139-
is_callable(array('Foo', 'foo'))
134+
is_callable(['Foo', '__construct']),
135+
is_callable(['Foo', 'foo'])
140136
);
137+
138+
?>
141139
]]>
142140
</programlisting>
143141
&example.outputs;

0 commit comments

Comments
 (0)