Return to 004.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / func |
1.1 ! misho 1: --TEST-- ! 2: General function test ! 3: --FILE-- ! 4: <?php ! 5: ! 6: echo "Before function declaration...\n"; ! 7: ! 8: function 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: ! 17: function some_other_function() ! 18: { ! 19: echo "This is some other function, to ensure more than just one function works fine...\n"; ! 20: } ! 21: ! 22: ! 23: echo "After function declaration...\n"; ! 24: ! 25: echo "Calling function for the first time...\n"; ! 26: print_something_multiple_times("This works!",10); ! 27: echo "Returned from function call...\n"; ! 28: ! 29: echo "Calling the function for the second time...\n"; ! 30: print_something_multiple_times("This like, really works and stuff...",3); ! 31: echo "Returned from function call...\n"; ! 32: ! 33: some_other_function(); ! 34: ! 35: ?> ! 36: --EXPECT-- ! 37: ! 38: Before function declaration... ! 39: After function declaration... ! 40: Calling function for the first time... ! 41: ---- ! 42: In function, printing the string "This works!" 10 times ! 43: 0) This works! ! 44: 1) This works! ! 45: 2) This works! ! 46: 3) This works! ! 47: 4) This works! ! 48: 5) This works! ! 49: 6) This works! ! 50: 7) This works! ! 51: 8) This works! ! 52: 9) This works! ! 53: Done with function... ! 54: ----- ! 55: Returned from function call... ! 56: Calling the function for the second time... ! 57: ---- ! 58: In function, printing the string "This like, really works and stuff..." 3 times ! 59: 0) This like, really works and stuff... ! 60: 1) This like, really works and stuff... ! 61: 2) This like, really works and stuff... ! 62: Done with function... ! 63: ----- ! 64: Returned from function call... ! 65: This is some other function, to ensure more than just one function works fine...