I made a form for a website where user posts data. For filtering and validation the string I wrote 3 functions for that but now its seems ugly when i call 3 functions in different lines. The data coming through the post method. I am not talking about nested functions here.
Can I call A function within another function like this?
php:
function apple($dates) {
return $dates;
}
function mango($sause) {
$mango = apple($sause);
return $mango;
}
Mureinik
315k54 gold badges390 silver badges403 bronze badges
1 Answer 1
In a word - yes. A function's code can definitely call another function.
answered Nov 24, 2017 at 21:31
4 Comments
Andreas
Or even itself.
Mureinik
@Andreas True 'dat
Mureinik
@bessy yup. Although it's probably a good idea to give your functions more descriptive names than
apple
and mango
.bessy
haha lol. First i wrote apple sause then i delete it lol any way Thanks for the quick response.
lang-php
:/