如何在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');

?>

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.