var-dump

Visually same string gives different var_dumps in php

旧街凉风 提交于 2019-12-08 08:42:50
问题 UPDATE: Anwer is here PHP unserialize fails with non-encoded characters? I'm trying to match objects with in_array. This works fine except for the object with this string as a property. Visually they are the same, but when I do a var_dump PHP sees different lengths. var_dump results: string(26) "Waar zijn mijn centjes👼" string(31) "Waar zijn mijn centjes👼" What can be the cause? Some ascii value I don't know of? 回答1: Let's look at the hex dump of your strings:

PHP refuses to output data from var_dump, print, etc

笑着哭i 提交于 2019-12-07 09:59:27
问题 I'm running a WAMP server at the moment, and have been spending the past 30 minutes trying to figure out how and why my project won't output any PHP data specified. At first, I thought that it was because I had an .htaccess file which output_buffering disabled, so I deleted that. Still, no dice. Then, I checked my httpd.conf , looked around for keywords such as display_errors , output_buffering , etc. and all seemed to be checked out just fine. Then, I tried turning on all error reporting by

Pretty dump variable/object in Symfony 2.*?

最后都变了- 提交于 2019-12-07 06:09:11
问题 When developing stuff I need to output the state of some instance in order to inspect it. While using CakePHP I always had a debug() function which does some kind of var_dump inside a <pre> html element, so the content is readable. Is something similar in Symfony 2.x too? 回答1: exit(\Doctrine\Common\Util\Debug::dump($someVar)); 回答2: use \Doctrine\Common\Util\Debug::dump($user); 回答3: As of today, one of the best ways to debug in Symfony that I know of is the Ladybug Bundle. Its output is

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

China☆狼群 提交于 2019-12-05 19:47:14
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: <?php $a = array (1, 2, array ("a", "b", "c")); var_export($a); ?> will output: array ( 0 => 1, 1 => 2, 2 => array ( 0 => 'a', 1 => 'b', 2 => 'c', ), ) However I'm looking to output into the following format like: $foo = array() $foo['0'] = 1 $foo['1'] = 2 $foo['2'] = array(); $foo['2']['0'] = 'a'; $foo['2']['1'] = 'b'; $foo['2']['2'] = 'c'; so execution of

PHP refuses to output data from var_dump, print, etc

淺唱寂寞╮ 提交于 2019-12-05 14:42:14
I'm running a WAMP server at the moment, and have been spending the past 30 minutes trying to figure out how and why my project won't output any PHP data specified. At first, I thought that it was because I had an .htaccess file which output_buffering disabled, so I deleted that. Still, no dice. Then, I checked my httpd.conf , looked around for keywords such as display_errors , output_buffering , etc. and all seemed to be checked out just fine. Then, I tried turning on all error reporting by placing error_reporting( E_ALL ) in my script. Yet again, no dice. Of course, after most of the changes

xdebug var_dump function colors

谁都会走 提交于 2019-12-05 12:09:55
I have installed xdebug on my computer with windows and it works fine by default - traces are colorfull and pretty but on another computer with ubuntu 10.10 its colourless and without any formatting. I tryed fill xdebug formatting parameters in php.ini but it didn't work for me :( What I need to make for improving output formatting? I faced this problem once upon a time and turned out to be : open php.ini and look for html_errors in your case it should be off , so simply turn it on and restart your apache and you would be good to go :) 来源: https://stackoverflow.com/questions/4534312/xdebug-var

save var_dump into text file [closed]

瘦欲@ 提交于 2019-12-04 16:50:28
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago . I have the php code for sql query <? $server = "127.0.0.1"; $username = "root"; $password = "1"; $link= connecttodb($server,$username,$password); function connecttodb($server,$username,$password) { $rez=fopen("test.txt","ab"); if ($link=mysql_connect ("$server","$username","$password",TRUE)) {

json_encode() returns false

瘦欲@ 提交于 2019-12-03 14:37:52
问题 This is the first time i ever face, that var_dumping json_encode of an array resulting boolean value. I have an array that was resulted from unserialization. I var_dumped it and made sure that it is a valid array. The result is like below. This is just a piece, not entire debug view. array (size=3) 'id' => string 'asco-power-technologies-l-p' (length=27) 'name' => string 'asco-power-technologies-l-p' (length=27) 'children' => array (size=2) 0 => array (size=4) 'id' => string 'apl-logistics'

PHP: Colors in var_dump (Ubuntu)

情到浓时终转凉″ 提交于 2019-12-03 13:03:25
问题 I'd like to see the colors and formatting that can come with var_dump. In my php.ini html_errors is set to On . This is confirmed by phpinfo() . My PHP version is 5.3.3 on Ubuntu 10.10. Anybody an idea? 回答1: You're looking for XDebug. sudo apt-get install php5-xdebug sudo /etc/init.d/apache2 restart and you're done. 回答2: Note: Maerlyn's approach should be taken for its simplicity. I wasn't aware of php5-xdebug being in the repos. I've decided to leave this answer because I feel it adds some

save var_dump into text file [closed]

↘锁芯ラ 提交于 2019-12-03 10:52:10
I have the php code for sql query <? $server = "127.0.0.1"; $username = "root"; $password = "1"; $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 "Connected successfully to >> " .$server ; $result = mysql_query('SHOW DATABASES'); echo "<br>"; while ($row = mysql_fetch_array($result)) { var_dump ($row); } } } ini_set('max_execution_time', 10); return $link; ?> this code print my database name on the browser how