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

PHP : No readable output, when I use the less than symbol, in combination with the var_dump() function

Why is in PHP this code snippet returning no readable output, $string = "Hello World!"
0
votes
1 answer

PHP var_dump() why is string count bigger if not sanitized?

I wanted to do some checking if a string (json), that is been post via a curl call, starts with a specific sub-string. When I kept getting return FALSE instead of TRUE I tried to debug it. I first adjusted my code so it will accept $_GET instead of…
Enes Palit
  • 41
  • 6
0
votes
1 answer

How do I get the array block from within the array?

I want to convert the xml data that I have generated from my system into an array array and send it to the API system of the platform I sell individually. I'd appreciate it if you could review and support. my array data example: Array ( …
erk
  • 1
  • 1
  • 1
0
votes
1 answer

How to get proper debug context from production PHP code? print_r vs var_export vs var_dump corner cases

Requirements We have production PHP code running on a webserver. In some sitations we want to enrich debug output (going e.g. to error.log) with context information. The context can have arbitrary fields and structure. Our goal is to find a general…
Christopher Lörken
  • 2,740
  • 18
  • 17
0
votes
1 answer

How Can I show Multidimensional Arrays (2D,3D,4D and more) like var_dump with loops and echo in PHP?

This is my array : $arr=array( array( array(array( "value1", "value2" ), "value2" ), array( "value3", "value4" ) ), array( array( "value5", "value6" ), array( "value7", "value8" ) ) ); if we print that with…
Amin Arjmand
  • 435
  • 7
  • 21
0
votes
1 answer

symfony/var-dumper in html format with live or hot reloading

I use symfony/var-dumper with the html format, I am wondering if there is a way to watch this html file online, so as not to reload the page (live / hot reloading). Is there a ready-made solution in a Symfony? Do you think it makes sense to debug in…
0
votes
0 answers

PHP on var_dump with certain string dumps different string

I give the PHP certain string to the var_dump command. But it outputs different string in the browser. First time see something like this, such a strange behaviour. I wonder if it is some security thing or other mechanics... I tried doing var_dump,…
0
votes
1 answer

How to parse stdClass object in php

Using var_dump from an API call give me the output like this How to put them into an array? thanks
0
votes
2 answers

(PHP) var_dumping an object in structured format.

I need to analyze an object in my code, but when I do a var_dump (or print_r) it just prints the object out with no structure, for example: [0]=> object(simple_html_dom_node)#2185 (9) { ["nodetype"]=> int(1) ["tag"]=> string(3) "div" ["attr"]=>…
Brent Heigold
  • 1,213
  • 5
  • 24
  • 50
0
votes
1 answer

Colored var_dump with Xdebug not working properly

I recently upgraded PHP to 7.2. I lost the colored var_dump. So, I read this post : How to get xdebug var_dump to show full object/array and install xdebug by following these instructions: http://www.dieuwe.com/blog/xdebug-ubuntu-1604-php7 and add…
Fifi
  • 3,360
  • 2
  • 27
  • 53
0
votes
2 answers

Reformatting a PHP var_dump

I just connected to a web service using SoapClient. The web service returns information regarding a vehicle based on a specific input, the vehicle's VIN. My $result variable is set equal to the web service output; thus, var_dump ($result); dumps all…
mugelloblue
  • 137
  • 1
  • 11
0
votes
1 answer

dump_destination in symfony/debug-bundle config

In my team we work with SF4 and use .env.dist (and so .env) for developer specific config. When we develop we find symfony/var-dumper very useful, however some devs like to dump in browser and some in console using server:dump command which comes…
DeveloperKid
  • 112
  • 1
  • 9
0
votes
0 answers

Php GET array0 on server

On my localhost when I use php I get this array(1) { ["lng"]=> string(3) "eng" } But on server I get this array(0) { }. Everything is exactly the same as on localhost.
Kosta
  • 37
  • 6
0
votes
1 answer

Convert implode string to interger variable PHP

Suppose after applying implode to an array , I got a String for example :- $var = 1631075,1631076; On applying var_dump to $var , I received the output as string(15) "1631075,1631076" how will I convert entire $var into Integer variable . Such that…
Ajanta
  • 11
  • 1
  • 4
0
votes
1 answer

how to get a specific format from var_dump function

I'm a beginner in PHP. I want to use var_dump($var1) to get the format string(10)"I Love PHP" When i use the function in sublime text editor, the output format is: string 'I Love PHP' (length=10) Note: I'm using xampp and xdebug.