What is "return function " ? Reason for using it ... It's function ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is "return function " ? Reason for using it ... It's function ?

3rd Nov 2016, 8:30 AM
Rishu Mahaseth
Rishu Mahaseth - avatar
4 Answers
+ 2
it use to send data to a new variable where you need that, and suppose you want to use some function that use to get some unique string from a file, and than want to store that string in MySQL. If you don't use return value, than you have to write it again and again. Writing function for a particular job increase your programing performance.
3rd Nov 2016, 8:45 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 1
I have no clue about php, but since it is general logic the answer is: To return a value. For instance you have a function that calculates something for you, so you expect a return value to store the result somewhere. Or you have something that reads or converts a file line by line and you get a string array/list back as return value.
3rd Nov 2016, 8:38 AM
Florian Schwarzer
0
where is the value returned ? why should we return the value ? :'(
3rd Nov 2016, 8:49 AM
Rishu Mahaseth
Rishu Mahaseth - avatar
0
return function is used to return the value ,<?php function subtract($x,$y) { return($x-$y); } echo subtract(10,5); ?>
8th Dec 2016, 7:45 AM
Vidadala Deepu
Vidadala Deepu - avatar