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
0
votes
1 answer

Save var_dump output array objects into a variable

I am using the following code : $key = 'xxx'; $secret = 'xxx'; $b = new Client ($key, $secret); var_dump ($b->getMarketSummary ($market)); And the output of var_dump is like this : array(1) { [0]=> object(stdClass)#3 (13) { …
Saeeds255
  • 3
  • 2
0
votes
2 answers

PHP variable var_dump = NULL?

I have a PHP script that calls the function fileRead2 function from the file fileRead2.php. The function below reads username.txt (Which display's the username). vim fileRead2.php
Gavin Jones
  • 185
  • 1
  • 3
  • 15
0
votes
1 answer

Why the 'NULL' value of a variable is not displayed using echo and print but displayed with var_dump() function?

As we all know if a variable is created without a value, it is automatically assigned a value of NULL. I have following code snippets : AND Both of the above code…
PHPLover
  • 1
  • 51
  • 158
  • 311
0
votes
1 answer

var_dump keeps saying false

My code trying to call to a steam api JSON file will not output to a var_dump it just continues to say bool(false)
Rain Drops
  • 31
  • 1
  • 6
0
votes
2 answers

save var_dump into text file for multi server ip from text file

this php code for sql query, if I have multi sql sever into text file and I want get servers from this file. how I can save var_dump for each sever into "serverip.txt"
Yasser Abo Reida
  • 353
  • 1
  • 4
  • 8
0
votes
2 answers

Twig gets an empty array but var_dum($myarray) says it's not empty

I need to pass an array to a Twig template. My code for this is:
Neniel
  • 163
  • 16
0
votes
3 answers

Why can't I seem to access elements of a multi dimensional array?

I have an XML file that was converted into an array with xpath. Ultimately I want to be able to access the variables in the array but no method seems to work. echo $items['member']['name']; Does not work echo $items['name']; Nor this echo…
BrandonFlynn-NB
  • 384
  • 2
  • 14
0
votes
1 answer

Getting a value from an object php

I used var_dump on an object in my code. print var_dump( $$user); result: object(stdClass)#35 (1) { ["user1_ready"]=> string(1) "0" } How do I get to this value (0 in this case). I tried print $$user which resulted in Catchable fatal error:…
ganjan
  • 7,356
  • 24
  • 82
  • 133
0
votes
1 answer

Object property not showing

I have a function on a php page that is intended to grab the creation date/time of video files using getid3. I thought everything had been working fine and was ready to put this version to bed when I was (of course) running everything one more time…
reddisht
  • 189
  • 2
  • 14
0
votes
1 answer

My login php form didnt enter in my 'if $result==true"

i do a login form for enter in the backoffice but whatever i put in login and password, i get all the time the redirection in else { header('Location: ../auth/login.php?error=1'); My code is :…
AlexDemzz
  • 243
  • 2
  • 18
0
votes
1 answer

Why is my $first-colour variable not dumping?

I'm making a button repeater inside a building block builder all created through Advanced Custom Fields and everything is working and printing fine except where I get to the part where I have to reset my $button_colour. It seems to be resetting it…
Aaron Davis
  • 140
  • 1
  • 7
0
votes
1 answer

Error found in xHTML output due to PHP's variables, $_SERVER and

I'm having this problem with validating a document that contains some basic PHP variables. Mainly I'm using html's h1, h2, and pre codes for formatting the text. My problem is that when I validate the document, it comes out with an error. The…
Muhammad Usman
  • 215
  • 5
  • 14
0
votes
1 answer

Replace var_dump with a custom function in PHP

I wonder if it is possible to replace var_dump with some user defined function. I know that you can use any kind of dumping functions of various modules, or some wrappers. But what I want to achieve is that anyone in my project who uses "var_dump",…
Asped
  • 3,083
  • 4
  • 31
  • 52
0
votes
2 answers

How to display var_dump(unserialize($data)) each item in newline

$data=memcache->get($key) if(!empty($data)) { var_dump(unserialize($data)); } How can I get each item in a new line instead of displaying as paragraph array.?
Ravi Teja
  • 119
  • 1
  • 2
  • 13
0
votes
1 answer

How not to explode sub-delimiter inside delimeter?

I have this string: text example (some text) (usb, apple (fruit), computer (technology), nature: sky) I need this var_dump() output with explode "(": array(3) { [0]=> string(34) "text example" [1]=> string(12) "some text" [2]=> …
kostya572
  • 169
  • 2
  • 21