I want to print out array elements from my custom function. Here is the fucntion :
$input = $_POST["input"];
function preprocessing($input){
$input = trim(strtolower($input));
$remove = '/[^a-zA-Z0-9]/s';
$result = preg_split($remove, $input, -1, PREG_SPLIT_NO_EMPTY);
for($i = 0; $i < count($resultl); $i++){
$result[$i] = trim($result[$i]);
}
return $result;
}
This is the input (example) : qwd qwd qwdqd123 13#$%^&*) ADDA ''''
I use print_r(preprocessing($input)); to print the array contents.
Output : Array ( [0] => qwd [1] => qwd [2] => qwdqd123 [3] => 13 [4] => adda )
Is there any method to customize the output ?
I want to make the output looks like this (my expectation) :
1 qwd
2 qwd
3 qwdqd123
4 13
5 adda
Thanks before.