0

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
asked Nov 24, 2017 at 21:30
3
  • You could have just run the code you wrote in your question and answered the question yourself. :/ Commented Nov 24, 2017 at 21:44
  • 2
    That's like eating without taking a picture of it Commented Nov 24, 2017 at 21:49
  • haha xD and @Sammitch yes i should have done that but i didn't know this is the right way for using multiple functions or not anyway i need some advise on this. Thanks Commented Nov 25, 2017 at 5:00

1 Answer 1

3

In a word - yes. A function's code can definitely call another function.

answered Nov 24, 2017 at 21:31

4 Comments

Or even itself.
@Andreas True 'dat
@bessy yup. Although it's probably a good idea to give your functions more descriptive names than apple and mango.
haha lol. First i wrote apple sause then i delete it lol any way Thanks for the quick response.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.