Questions tagged [var-dump]

var_dump is a PHP function that dumps information about a variable.

var_dump is a PHP function that dumps information about a variable.

Examples

$a=array(1,2,3);
var_dump($a);
$b="hello so";
var_dump($b);

returns

array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) }
string(8) "hello so"

References

332 questions
-1
votes
1 answer

Getting empty value from array

I have the following code and $totalDonations should output 1500. get_results(" SELECT amount FROM wp_fullstripe_payments "); ?>
Alexnl
  • 397
  • 1
  • 3
  • 12
-1
votes
2 answers

How do I stop PHP PDO from displaying automatic var_dumps?

I've got a unique error that I think most people would kill for, but I just want to turn it off. The issue is that when using anything PDO, I get a var_dump of the PDOStatement. This happens on web pages, and CLI php scripts, and it is very annoying…
-2
votes
1 answer

Get PHP Var_Dump Output in XML

I am using SoapClient to return data from a Web Service provider. The data is returned in a typical object/array PHP format. I want to return it in XML. Here is my code to call the Web Service (I have omitted my username and…
mugelloblue
  • 137
  • 1
  • 11
-2
votes
1 answer

UTF8 correct string length with vardump

How can I make var_dump like output from an array that manages string characters length well, that is the same counts with and without accents? /var/www/test.php:4: array (size=2) 0 => string 'qwertzuiop' (length=10) 1 => string 'qwértzúíóp'…
-2
votes
2 answers

Laravel: retrieving data from a select statement

I Tried retrieving my data from $result via: $result->pluck('request_time'); and $result->request_time; Both give me a non-object error, var_dump returns: array (size=1) 0 => object(stdClass)[167] public 'id' => string…
Larry Mckuydee
  • 473
  • 2
  • 6
  • 10
-2
votes
2 answers
-2
votes
1 answer

Same string, but var_dump shows weird data

I have a variable $username that I substring from a url string, which I get from a file. This is the output of var_dump($username): "tring(18) "honorablevacuum87 if I set $username = "honorablevacuum87" and I var_dump it, I get: string(17)…
dsthetics
  • 287
  • 1
  • 7
  • 19
-2
votes
1 answer

Can var_dump a string but can not echo the string

I meet a trouble with string. I use file_get_contents($url) to get content of a website. $content = tile_get_contents($url); $arrTmp = explode('>',$content); var_dump (trim( $arrTmp[100]) ) => result is: string '
Tran Hieu
  • 3
  • 1
-3
votes
1 answer

What value will var_dump show that echo will not show? (Only one word answer)

I was solving a question and got to see this one. I really don't know what it is. Just needed a one word answer for the problem.
-3
votes
2 answers

Foreach values from array inside array

hi i need to get the values of a var that after making it a var_dump($var) i get: array(1) { ["docs"]=> array(3) { [0]=> array(1) { ["imgurl"]=> string(68) "http://xxxxx.com/demos/grider/wp-content/uploads/2013/02/22.jpg" }…
Jose Lo
  • 81
  • 2
  • 10
-4
votes
5 answers

How to access product title from this JSON

I have retrieved some data like this: object(stdClass)[1] public 'status' => string 'ok' (length=2) public 'data' => object(stdClass)[3] public 'sort_data' => object(stdClass)[2] public 'sort_column' => string…
user9277271
-4
votes
4 answers

Cannot use [ ] for reading

I tried to do var_dump($_SERVER[]); I received this error: Cannot use [] for reading Any hints for me?
code-8
  • 54,650
  • 106
  • 352
  • 604
-4
votes
3 answers

How can i get just the session username using var_dump() or print_r()

I tried getting session information on my iframe using var_dump(). I got this output. `array(3) { ["_sf2_attributes"]=> array(5) { ["identity"]=> string(18) "xxxxxxxxxxx" ["username"]=> string(17) "xxxxxxxxxxxx" ["email"]=> …
seowebanalyst
  • 19
  • 1
  • 8
-4
votes
1 answer

Array not an Array?

Very simple and probably noob question about php. i run the following; var_dump($this->criteria); which returns me : object(SimpleXMLElement)[24] public 'id' => string '3C222489-4BE4-47BB-A731-EFCF98B9979F' (length=36) public 'parentId' => string…
Simon
  • 3
  • 1
-5
votes
2 answers

get values from PHP var_dump from XML string

I have XML string $input which is received from SOAP service $xml = new SimpleXMLElement($input); echo var_dump($xml). "
"; gives output: object(SimpleXMLElement)#3 (2) { ["result"]=> string(5) "False" ["error"]=> string(13) "Login…
waghso
  • 623
  • 7
  • 23
1 2 3
22
23