Rajasekaran Raji
Rajasekaran Raji

Reputation: 74

How to get a function values inside of function in PHP?

How to get a values in function of inner function in php?

<?php

function rating($val){

}

function cal($val){
}

echo rating(cal('q1'));
echo rating('q1');
echo cal('q1');

?>

Upvotes: 0

Views: 43

Answers (1)

arkascha
arkascha

Reputation: 42925

Your question is very vague, but I guess this is what you are looking for:

<?php
function rating($val) {
    return cal($val);
}
function cal($val) {
    return do_something_with_value($val);
}
echo rating('q1');

Another option would be something like that:

<?php
function rating($val) {
    return do_something_else_with_value($val);
}
function cal($val) {
    return do_something_with_value($val);
}
echo rating(cal('q1'));

When asking a question it is often a good idea to explain what you are trying to do instead of how you think you might be able to do it.

Upvotes: 1

Related Questions