How to determine whether the passed parameter is a variable?
扬帆起航
扬帆起航 2022-11-15 10:30:46
0
3
1070

function is_var($var){//???How to write}$a = 123;var_dump(is_var($a));//true

var_dump(is_var('456')) ;//falsevar_dump(is_var(456));//falsevar_dump(is_var([1,2,3]));//false...

That is, pass the parameters directly If a value is written, false is returned. If a variable is defined, true is returned.

Is there any way? . .

扬帆起航
扬帆起航

reply all(3)
飞天001

Can I judge that the one with $ in front is a variable? I am a novice and I am just talking nonsense.

扬帆起航

How can I edit a post without deleting it? . . . The first time I posted, it showed up in a mess. . .

扬帆起航

function is_var($var){

//???How to write

}

$a =123;

var_dump(is_var ($a));//true

var_dump(is_var('456'));//false

var_dump(is_var(456));// false

var_dump(is_var([1,2,3]));//false

......

That is, if you pass the parameter and write the value directly, return false , if a variable is defined, return true

Is there any way? . .

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template