How to get the last used variable in PHP?

in bash there is something like

$_

which is a temporary variable in which the last argument of the previous command is stored

is there a similar variable or constructor in PHP or how can I access the last used variable in a script?

it would be very convenient for simple debugging functions or if you need a function that you have to add in several places in your code.

Or you can add something like:

do_some_more($_); 

in several places in your code

+4
source share
1 answer

There is no such function in PHP.

$ _ like any other variable.

$_ = 'hello world';

echo $_; // hello world
0
source

All Articles