小编Dan*_*inu的帖子

如何在php的同一页面中将变量从一个函数传递到另一个函数?

好了,我现在有另一个问题,我想将一个或多个变量从一个函数发送到另一个函数,如下所示:

class test{

    var $text2;

    function text1($text1){ // This will catch "This is text" from $text variable.

        $text1 = $this -> text2; // Giving $text1 value to $text2 

        return $this -> text2; // Now here is the trouble i think, i want to send the variable to the next function that is text2(). How do i do that?

    }
    function text2($text2){ // Here is the place that says undefined variable i want the variable $text2 from function text1() to be …
Run Code Online (Sandbox Code Playgroud)

php variables class function

-1
推荐指数
1
解决办法
7549
查看次数

标签 统计

class ×1

function ×1

php ×1

variables ×1