codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php $responseText = array( array("hey","hi","hello there"), "! ", array("i am", "i'm"), " ", array("good", "great"), "! " ); echo randomResponse($responseText); function randomResponse($array){ $result=''; foreach ($array as $item){ if (is_array($item)){ $result.= $item[rand(0, count($item)-1)]; }else{ $result.= $item; } } return ($result); } ?>
Private
[
?
]
Run code
Submit