xref: /PHP-5.6/tests/func/004.phpt (revision b70f9421)
1--TEST--
2General function test
3--FILE--
4<?php
5
6echo "Before function declaration...\n";
7
8function print_something_multiple_times($something,$times)
9{
10  echo "----\nIn function, printing the string \"$something\" $times times\n";
11  for ($i=0; $i<$times; $i++) {
12    echo "$i) $something\n";
13  }
14  echo "Done with function...\n-----\n";
15}
16
17function some_other_function()
18{
19  echo "This is some other function, to ensure more than just one function works fine...\n";
20}
21
22
23echo "After function declaration...\n";
24
25echo "Calling function for the first time...\n";
26print_something_multiple_times("This works!",10);
27echo "Returned from function call...\n";
28
29echo "Calling the function for the second time...\n";
30print_something_multiple_times("This like, really works and stuff...",3);
31echo "Returned from function call...\n";
32
33some_other_function();
34
35?>
36--EXPECT--
37
38Before function declaration...
39After function declaration...
40Calling function for the first time...
41----
42In function, printing the string "This works!" 10 times
430) This works!
441) This works!
452) This works!
463) This works!
474) This works!
485) This works!
496) This works!
507) This works!
518) This works!
529) This works!
53Done with function...
54-----
55Returned from function call...
56Calling the function for the second time...
57----
58In function, printing the string "This like, really works and stuff..." 3 times
590) This like, really works and stuff...
601) This like, really works and stuff...
612) This like, really works and stuff...
62Done with function...
63-----
64Returned from function call...
65This is some other function, to ensure more than just one function works fine...
66