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
2 answers

How can I print days of a month with moment php?

I am working with moment.php. I want to print all days of for example the month april 2018: $weekdayNumbers = [ 1,2,3,4,5,6,7 ]; $m = new \Moment\Moment(); $dates = $m->getMomentsByWeekdays($weekdayNumbers, 3); echo "
";                   …
peace_love
  • 6,229
  • 11
  • 69
  • 157
0
votes
2 answers

var_dump shortcut access in Visual Studio Code

how can I get quick access to var_dump in Visual Studio Code editor? For example: I enter vd letters and after pressing the Enter key I get var_dump("");.
kz_dev
  • 3
  • 1
  • 3
0
votes
0 answers

How to config var_dump to show result in pre tag

I have recently updated wampserver from version 3.0 to 3.1 and before the var_dump showed me the results in pre tags, now I have seen the configuration in php.ini and xdebug is installed and configured. I do not know if someone has already found…
0
votes
1 answer

DateTime instance property changes due to a var_dump() or print_r()

I have the following code: timezone = 'Europe/Madrid'; var_dump($date->timezone); // Shows 'Europe/Madrid' var_dump($date); // Shows 'UTC' (!) var_dump($date->timezone); // Shows…
Ricardo Pérez
  • 215
  • 1
  • 8
0
votes
1 answer

symfony VarDumper show file and line

When using the VarDumper function dump() in a symfony project the file and line of where dump() was called is shown. When using the VarDumper component standalone file and line is not shown. I guess in Symfony it's somewhere configured in the…
ivoba
  • 5,780
  • 5
  • 48
  • 55
0
votes
0 answers
0
votes
2 answers

var_dump inside wordpress functions.php

what I want to do: my contact form 7 is very simple. I have a input field and a submit button. I want to manipulate the data from the textfield instead of (or maybe before, but for now just say, instead of) sending an email. let's say I want to add…
lechnerio
  • 884
  • 1
  • 16
  • 44
0
votes
1 answer

I can't interpret this array of objects var_dump output in PHP

I'm a total newb to PHP and I'm having a logic problem in my code (array_rand($arrCards,1) is running out of elements before it should). So I've done a var_dump of the array and I get this output (brief excerpt): array (size=52) 0 => …
erv
  • 593
  • 8
  • 27
0
votes
1 answer

Paragraph does not work (var_dump)

this is my first post and I am new to this community. I'm currently learning php, but facing an issue with paragraphs: "; echo strlen($name) . "
"; var_dump($name) . "
"; echo "Heyho" .…
user8389401
0
votes
0 answers

PHP Won't Match String - Encoding Issue?

I "solved" this myself: the text files must be encoded ANSI. But I don't know why, or why filter_var() didn't help, so I thought this would still be educational for myself and others. I haven't learned databases yet so I've started my foray into…
Lee Saxon
  • 457
  • 3
  • 14
0
votes
2 answers

Any way to make PHP var_dump display deeper nested arrays?

I am working on a script that takes uploaded INI files and converts them to a database. The INI files are quite poorly written and created loops inside themselves. I am first converting the INIs into arrays, nested in the way that they will be…
Trevor
  • 2,792
  • 1
  • 30
  • 43
0
votes
1 answer

$_POST contains array with string, bind it to variable

A var_dump of $_POST gives the following result: array(1) { ["postID"]=> array(1) { [0]=> string(2) "76" } } I want to bind the data from position [0] -> "76" to a variable called $id. What is the correct…
Moya
  • 89
  • 1
  • 2
  • 10
0
votes
4 answers

PHP:: cannot retrieve all values inside array

Here is my simple code: 'Carrot', 'Apple', 'Orange', 2 => 'Boiled Egg', 'Omelet', 3 => 'Ice Cream', 'Pancake', 'Watermelon' ); echo'
';
var_dump($components);
echo'
'; output : array(6) { [1]=> string(6)…
PUG
  • 331
  • 1
  • 4
  • 14
0
votes
2 answers

Drupal: Can't print inside hook_node_insert

On my Drupal 7 Site I am trying to create my very first own module. I've got a custom node_insert hook like the one below: function sample_node_insert($node){ dpm($node); var_dump($node); } I just want to see what is inside of $node, but I just…
Lumination
  • 47
  • 7
0
votes
2 answers

How can I extract values from the array of JSON data that this var_dump gives

How can I extract title and content from the array of JSON data that gives the following when I var_dump(WpApi::posts()); array(3) { ["results"]=> array(1) { [0]=> array(23) { ["id"]=> int(8) ["date"]=> string(19) "2017-01-31T07:08:21"…
Dave Chambers
  • 2,483
  • 2
  • 32
  • 55