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
4
votes
3 answers

var_dump() of strings and variables not showing desired results

I am working on a script that curls another site and then parses the results. I seem to be having some weird problems and I can't understand where they are coming from; I have included the problematic part of my code as well as the output that is…
4
votes
3 answers

var_dump outputting empty string - php

Hi I am performing an SQL query (that only returns one row) and I am printing a particular column on screen just for test purposes. The problem I am having is, the column that I am printing contains a string of 12 characters (abcdef123456), yet…
M9A
  • 3,168
  • 14
  • 51
  • 79
3
votes
1 answer

What are the numbers in var_dump result?

What do the numbers #11 and (0) mean in this var_dump result: object(PDO)#11 (0) { } I have a class and I made from it an object and used it in multiple places.
BasharIT
  • 51
  • 4
3
votes
1 answer

How to remove special characters?

How to remove special characters? foreach ($login_and_logout_list['rval'] as $k => $v) { $login_time[] = $v['login_time']; $logout_time[] = $v['logout_time']; $create_time[] = $v['create_time']; $i++; } var_dump($login_time); What i am…
user8823283
3
votes
1 answer

Why does adding a 0 in front of the number change its value

Why does var_dump(16) // displays int(16) but var_dump(016) // displays int(14) Anyone can help me solve this problem?
Nhan Nguyen
  • 197
  • 1
  • 9
3
votes
1 answer

var_dump a php Class object reveals database username and password

I am a bit worried when I incidentally var_dump() the object of a child class, the result showed all my sql elements and variable values including database username,password and DBname. Is there a security issue with it. If yes how do I shield it?…
3
votes
3 answers

How to export PHP array where each key-value pair is in separate line?

I'm looking for equivalent functionality to var_export() which allows me to export PHP array into parseable code, but each statement should be printed in separate line (so each line has its own independent structure). Currently this code:
kenorb
  • 155,785
  • 88
  • 678
  • 743
3
votes
4 answers

PropertyInfo.GetValue(object) fails with IEnumerable [C#, Reflection]

I have the following problem: I am currently writing the c# equivalent of PHP's var_dump-method. It works perfectly with 'simple' classes and structures (and even with arrays). My only problem is when it comes to other IEnumerable, like List
unknown6656
  • 2,765
  • 2
  • 36
  • 52
3
votes
5 answers

Cant get value in PHP array but var_dump shows that it exists

Long time, my PHP-application ran on a linux server with apache and PHP. Now I've set up a windows server with apache and php and simple PHP-Programs have problems. var_dump($data); die(var_dump($data['a'])); results in object(stdClass)#1 (1) {…
feedc0de
  • 3,646
  • 8
  • 30
  • 55
3
votes
1 answer

The square brackets after the var_dump output in PHP

I tried to var_dump a Zend_Controller_Request_Http object in Zend framework. The output is below: object(Zend_Controller_Request_Http)[14] protected '_paramSources' => array (size=2) 0 => string '_GET' (length=4) 1 => string…
roast_soul
  • 3,554
  • 7
  • 36
  • 73
3
votes
1 answer

PHP Empty string of length 32

EDIT: The string was being outputted and interpreted by the browser. Silly mistake. In my project, I have created a class to generate the HTML tags I need, rather echo them all out myself. I have a function called generateTag($control,…
James Hall
  • 300
  • 3
  • 10
3
votes
1 answer

PHP: Long strings, json_encode, var_dump and echo

I noticed that the application I was developing was breaking, I managed to narrow it down to this problem (I have set up a test case for it): ini_set("display_errors", "1"); error_reporting(E_ALL); error_log("[test] Memory limit: " .…
Jeremy
  • 91
  • 1
  • 7
3
votes
2 answers

Using FirePHP instead of var_dump

When I output a variable using fb() function it only output the variable value, is there any way so it show also variable type like what var_dump does? Nor show name of variable, it any one shows that world would be more beauty!
Handsome Nerd
  • 17,114
  • 22
  • 95
  • 173
3
votes
3 answers

PHP view special characters in a string

Trying to figure out, what PHP is doing with newlines and special characters. I have a string, when I do var_dump($string) the output is: string 'ls -al free -m' (length=16) How do I view the special characters buried in here? For example need…
Justin
  • 42,716
  • 77
  • 201
  • 296
3
votes
3 answers

Why can var_dump ascertain values of private variables, yet it can't when trying to access a single the property

I have an object that is being thrown into the session array, and I want to run a foreach on the items property. I can't seem to access it. I see that it's private, but I can't help but wonder why var_dump can show me what the property contains…
Rooster
  • 9,954
  • 8
  • 44
  • 71