PHP View the current variable type method, PHP view the current variable
Below the PHP view of the current variable type background, process and solutions are written to everyone, as follows:
Resolving the background
Toss process one:
The Json_decode of JSON in PHP has not worked without any output
Period, need to understand a:
Copy the Code code as follows:
Php:curl_exec–manual
Curl_exec returns the type of variable $respjson that is not a string type.
Toss process two:
1. Search:
Copy the Code code as follows:
PHP Check Variable type
Reference:
Php:gettype–manual
Php:is_string–manual
Php:is_int–manual
So try it out:
Copy the Code code as follows:
$respJson = $crifanLib->geturlresphtml ($GETTOKENURL);
$crifanLib->logwrite ("respjson=%s", $respJson);
Echo GetType ($respJson);
echo is_string ($respJson);
echo "Before Decodedjsonobj";
$DECODEDJSONOBJ = Json_decode ($respJson);
Results:
There is still no output ...
2. Try:
Copy the Code code as follows:
Echo GetType ($respJson);
echo is_string ($respJson);
Results:
Copy the Code code as follows:
Output: String1
It proves that the type of the variable here is indeed a string.
Summarize
The variable type obtained in PHP is GetType ($var);
Individual judgments are of a certain type, which can be used:
Copy the Code code as follows:
Is_int
Is_string
Wait a minute.
The above is for PHP to view the current variable types of methods, I hope you like.
http://www.bkjia.com/PHPjc/1041335.html www.bkjia.com true http://www.bkjia.com/PHPjc/1041335.html techarticle PHP View the current variable type method, PHP view the current variable below the PHP view current variable type background, process and solutions are written to everyone, specifically as follows: ...