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

How do I access this array using var_dump? PHP

I would like to display the text 'hamsters repeat one'. My array: a:1:{i:0;s:19:"hamsters repeat one";} Should I use var_dump for this? In PHP. I know how to get the array data out of the database (I am using get_post_meta a wordpress…
user2312612
0
votes
1 answer

var_dump only shows 1 array when upload more than 1 file

i have a script that uploads images and then crops them. but when i use
and then do a var_dump i only get 1 array instead of 'for example' 10 images. My uploadform:
Kees Sonnema
  • 5,759
  • 6
  • 51
  • 106
0
votes
2 answers

var_dump array using preg_match

I have a bunch of arrays that I'd like to var_dump. These arrays are named based off of a $_GET from a form, so each are different but have a pre defined name attached to the start so I might have array_bob, array_mary, array_sam where bob mary and…
user1871245
0
votes
1 answer

PHP Array element returning null when accessed directly

Any idea why this would happen? code: $property); var_dump($this->$property[0]); ?> output: Array ( [0] => WP_Post Object ( [ID] => 34901 [post_author] => 1 [post_date] =>…
jessica
  • 3,051
  • 2
  • 30
  • 31
0
votes
1 answer

var_dump says String of 75 characters, can't echo it and doesn't json_decode()

I am posting some data to a PHP page with AJAX, but I can't decode it. json_decode() returned NULL. So I figured that if I'd echo it I could run it through jsonlint. But nothing showed up. To find out if the data reaches the PHP page I tried to…
11684
  • 7,356
  • 12
  • 48
  • 71
0
votes
3 answers

PHP File Upload. var_dump returns empty string

I'm trying to create file upload with php. But $_FILES['photo']['name'] returns nothing. Then I googled lot and find out about the var_dump method. When I run it. It returns following array. array (size=5) 'name' => string '' (length=0) 'type'…
Isuru Madusanka
  • 1,397
  • 4
  • 19
  • 27
0
votes
1 answer

How to store associated array with binary data for editing in notepad?

I have an array and it looks like $a=array('HEX'=>Chr(0).Chr(1).Chr(2),'b'=>123,'c'.......); I need to store it in text file, open in text editor and edit it. $fwp = fopen ('edit.txt', "wb"); FWrite($fwp,var_export($a,true)); FClose ($fwp); I see…
el Dude
  • 5,003
  • 5
  • 28
  • 40
0
votes
2 answers

PHP var_dump and loop giving different results

I have the following code: var_dump($cursor); foreach($cursor as $obj) { echo "
"; echo "" . $obj['nick'] . ""; echo "
"; } The result of var_dump is the…
john smith
  • 565
  • 1
  • 10
  • 20
0
votes
3 answers

CakePhp debug/var_dump styling

This may be a simple question for those more adept at CakePHP than me BUT: I have two environments [work and home], which I've been using github to work between. If I run a var_dump() on my work machine, the resultant dump is a CakePHP formatted…
elb98rm
  • 670
  • 6
  • 21
0
votes
1 answer

Call to a member function bind_param() on a non-object when inserting database information

This is the first time I have ever used Mysqli, so when it comes to adding information in the database I am a little lost. Here is the script that I have.
kira423
  • 325
  • 1
  • 5
  • 26
0
votes
0 answers

Add Array Column to Multidimensional Array Using array_merge in foreach Loop

I'm trying to add another column of data to each row in a foreach loop. It's purpose is to remember the element of data importeded from XML processed to an multidimensional array. It's stuck as a scalar though the var_dumps looks fine.
Jarrett Mattson
  • 1,005
  • 2
  • 9
  • 14
0
votes
1 answer

Var Dump Not Displaying

Im trying to get the Var Dump to display but all i get is a white screen. Any suggestions?
user1537210
  • 15
  • 1
  • 7
0
votes
2 answers

Unable to access array from included file when using require_once

My issue is that if I use require_once to include a file that has an array, I can't access that array from the file that's including it. For example this is my foo.php file And this is my…
Haider Ali
  • 918
  • 2
  • 9
  • 26
0
votes
1 answer

Disable call stack table but enable formatted var_dump in xdebug

how i should configure xdebug to show formatted var_dump, but disable call stack tables ? those are my current entries in php.ini…
ChazzBG
  • 1
  • 2
0
votes
1 answer

double output for variable

I have this next function: function checkLoggedIn($status, $redirect=TRUE){ switch($status){ case "yes": if(!isset($_SESSION["loggedIn"])){ if($redirect) { header("Location: login.php"); …
Alex
  • 7,538
  • 23
  • 84
  • 152