I have two functions within a PHP class. I want to use the output of the first function within the second, but I always get an internal server error.
Simplified example:
<?php
class TestClass{
private function return_string(){
$test = 'test variable';
return $test;
}
private function encode_string() {
$x = return_string();
return json_encode($x);
}
}
?>
I've tried returning the string directly from return_string() (not that this is what I want) and even this still gives an error. If I set $x to a string instead of the function return_string() it works fine, so everything in the encode_string() function seems fine. Not sure what else to check.