File tree Expand file tree Collapse file tree 3 files changed +23
-22
lines changed Expand file tree Collapse file tree 3 files changed +23
-22
lines changed Original file line number Diff line number Diff line change 1
1
--TEST--
2
2
Static variables in functions
3
- --SKIPIF--
4
- <?php if (version_compare (zend_version (), "2.0.0-dev " , '>= ' )) echo "skip removed in Zend Engine 2 \n" ; ?>
5
3
--FILE--
6
4
<?php
7
- old_function blah (
5
+ function blah ()
6
+ {
8
7
static $ hey =0 ,$ yo =0 ;
9
8
10
9
echo "hey= " .$ hey ++.", " ,$ yo --."\n" ;
11
- );
10
+ }
12
11
13
12
blah ();
14
13
blah ();
Original file line number Diff line number Diff line change 1
1
--TEST--
2
2
General function test
3
- --SKIPIF--
4
- <?php if (version_compare (zend_version (), "2.0.0-dev " , '>= ' )) echo "skip removed in Zend Engine 2 \n" ; ?>
5
3
--FILE--
6
4
<?php
7
5
8
- old_function a (
6
+ function a ()
7
+ {
9
8
echo "hey \n" ;
10
- );
9
+ }
11
10
12
11
function b ($ i )
13
12
{
@@ -34,13 +33,14 @@ c(7,14);
34
33
a ();
35
34
36
35
37
- old_function factorial $ n (
36
+ function factorial ($ n )
37
+ {
38
38
if ($ n ==0 || $ n ==1 ) {
39
39
return 1 ;
40
40
} else {
41
41
return factorial ($ n -1 )*$ n ;
42
42
}
43
- );
43
+ }
44
44
45
45
46
46
function factorial2 ($ start , $ n )
@@ -63,17 +63,18 @@ for ($k=0; $k<10; $k++) {
63
63
64
64
echo "and now, from a function... \n" ;
65
65
66
- old_function call_fact (
66
+ function call_fact ()
67
+ {
67
68
echo "(it should break at 5...) \n" ;
68
69
for ($ i =0 ; $ i <=10 ; $ i ++) {
69
70
if ($ i == 5 ) break ;
70
71
$ n =factorial ($ i );
71
72
echo "factorial( $ i) = $ n \n" ;
72
73
}
73
- );
74
+ }
74
75
75
- old_function return4 ( return 4 ; );
76
- old_function return7 ( return 7 ; );
76
+ function return4 () { return 4 ; }
77
+ function return7 () { return 7 ; }
77
78
78
79
for ($ k =0 ; $ k <10 ; $ k ++) {
79
80
call_fact ();
@@ -86,12 +87,13 @@ echo "$result\n";
86
87
$ result =factorial2 (return4 (),return7 ());
87
88
echo "$ result \n" ;
88
89
89
- old_function andi $ i , $ j (
90
+ function andi ($ i , $ j )
91
+ {
90
92
for ($ k =$ i ; $ k <=$ j ; $ k ++) {
91
93
if ($ k >5 ) continue ;
92
94
echo "$ k \n" ;
93
95
}
94
- );
96
+ }
95
97
96
98
andi (3 ,10 );
97
99
--EXPECT --
Original file line number Diff line number Diff line change 1
1
--TEST--
2
2
General function test
3
- --SKIPIF--
4
- <?php if (version_compare (zend_version (), "2.0.0-dev " , '>= ' )) echo "skip removed in Zend Engine 2 \n" ; ?>
5
3
--FILE--
6
4
<?php
7
5
8
6
echo "Before function declaration... \n" ;
9
7
10
- old_function print_something_multiple_times $ something ,$ times (
8
+ function print_something_multiple_times ($ something ,$ times )
9
+ {
11
10
echo "---- \nIn function, printing the string \"$ something \" $ times times \n" ;
12
11
for ($ i =0 ; $ i <$ times ; $ i ++) {
13
12
echo "$ i) $ something \n" ;
14
13
}
15
14
echo "Done with function... \n----- \n" ;
16
- );
15
+ }
17
16
18
- old_function some_other_function (
17
+ function some_other_function ()
18
+ {
19
19
echo "This is some other function, to ensure more than just one function works fine... \n" ;
20
- );
20
+ }
21
21
22
22
23
23
echo "After function declaration... \n" ;
You can’t perform that action at this time.
0 commit comments