dump_destination in symfony/debug-bundle config

ε祈祈猫儿з 提交于 2021-01-29 12:28:54
问题 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 with symfony/debug-bundle. It's very annoying to comment out / uncomment debug.dump_destination key over and over after pulling from remote or worry about conflicts when current remote HEAD happens to have this file also edited. I did my best to

Xdebug does not work with var_dump()

社会主义新天地 提交于 2021-01-27 04:41:07
问题 I'm not sure why, but xdebug does not highlight var_dump(). But config seems to be fine. Have no idea why... Any suggestions? This is my phpinfo(); plus even xdebug_var_dump() doesn't highlight anything. It works, but look like normal var_dump(). 回答1: I found that option "xdebug.default_enable Off Off" in you php_info(). I also have noticed that in last versions of EasyPHP this option is turned off. So turn it on by setting this line in php.ini: xdebug.default

Printing more than one array using print_r or any other function in php

戏子无情 提交于 2020-06-14 04:12:45
问题 I need to print contents of multiple arrays in my code. Eg function performOp($n, $inputArr, $workArr) { printf("Entered function, value of n is %d", $n); print_r($inputArr); print_r($workArr); $width =0; } Now, Instead of writing print_r twice, is there any way I can write a single statement and print both the arrays ? Also, If I want to print "Input array value is " before displaying the Array{}, is there a way to do so using printf or any other function? I tried writing printf("Value of

How to print Array READABLE

北城余情 提交于 2020-01-16 00:45:36
问题 How do i print an Array readable? print_r($array); and var_dump($array); both produce some very ugly clutter of that $array. Ok it is what it says, it prints that array, but i'd like to have some well formated print of that array, how do i do that? 回答1: Actually, it is well-formatted but HTML ignores line breaks and double spaces. You just have to view the page's source code (CTRL+U or right-click > view source code) 回答2: echo '<pre>'; var_dump($array); echo '</pre>'; Or to a better yet

Does xdebug beautify var_dump?

微笑、不失礼 提交于 2020-01-10 17:43:48
问题 According to this article,, var_dump is supposed to beautify the outputs. I have installed xdebug on my local host with PHP Version 5.3.3-1ubuntu9.2. I have this in my php.ini outputs. This program makes use of the Zend Scripting Language Engine: Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans However when I use var_dump(), nothing changes. Does xdebug really beautify the var_dump

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

左心房为你撑大大i 提交于 2020-01-03 04:51:08
问题 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" <? $list =file('servers.txt'); $username = "root"; $password = "1"; foreach($list as $server) $link= connecttodb($server,$username,$password); function connecttodb($server,$username,$password) { $rez=fopen("test.txt","ab"); if ($link=mysql_connect ("$server","$username","$password",TRUE)) { fwrite($rez,"".$server." \r\n"); echo

How to create an array from output of var_dump in PHP?

久未见 提交于 2019-12-30 09:39:12
问题 How can I parse the output of var_dump in PHP to create an array? 回答1: Use var_export if you want a representation which is also valid PHP code $a = array (1, 2, array ("a", "b", "c")); $dump=var_export($a, true); echo $dump; will display array ( 0 => 1, 1 => 2, 2 => array ( 0 => 'a', 1 => 'b', 2 => 'c', ), ) To turn that back into an array, you can use eval, e.g. eval("\$foo=$dump;"); var_dump($foo); Not sure why you would want to do this though. If you want to store a PHP data structure

how do i get only values from var dump array?

拥有回忆 提交于 2019-12-24 16:26:03
问题 Is it possible to escape array(1) { [0]=> string(12)} from var_dump($variable) because I want to show only values from var_dump and except array string ? Testing Code <?php $array = array( "foo" => "bar", "bar" => "foo", 100 => -100, -100 => 100, ); var_dump($array); ?> now results will be like this array(4) { ["foo"]=> string(3) "bar" ["bar"]=> string(3) "foo" [100]=> int(-100) [-100]=> int(100) } But I want to get only bar and foo values except string(3) and array(4)? 回答1: Right here:

Colored var_dump() and errors

时光怂恿深爱的人放手 提交于 2019-12-23 09:38:02
问题 How can I set style to var_dump() function and PHP errors style, like on the next image? At the moment I have next view of var_dump() (with <pre>var_dump(...)</pre> , without it will be all in one line) and just plain text for errors. I searched something for PHP colored errors, var_dump styles, but could not find anything. I used OpenServer as localhost, and on previous version I had same styles for errors, but now just plain text. Is it real to customize? 回答1: You get the colored output

Alternative var_dump for PHP that allows limiting depth of nested arrays

风流意气都作罢 提交于 2019-12-23 07:55:35
问题 I try to use var_dump on command line with phpsh in order to get debugging information about some variable. But the variable contains a very deeply nested data structure. Therefore, using the default var_dump outputs too much information. I want to limit the depth level of var_dump output. I found that XDebug's var_dump implementation allows depth limiting as described here: Unfortunately, I couldn't make this