I personally use var_dump, but lots of people like print_r.
What does everyone use? Pros and Cons?
Does someone have a special home brew function of their own?
...
Hi, I would like to see the structure of object in JavaScript (for debugging). Is there anything similar to var_dump in PHP?
Thanks
...
Greetings,
I am trying to debug a login script. So I decided to use var_ dump to print out the password. But for some reason say If I type in 'BOSTON' rather then printing 'BOSTON' it prints out six dashes, 1 dash for each character. I haven't encountered it like this before. I'm sure i'm missing something. I tried ob_ start() var_ dump...
The title should be clear.
...
I'm looking for a way to get the instance ID of a given object / resource with PHP, the same way var_dump() does:
var_dump(curl_init()); // resource #1 of type curl
var_dump(curl_init()); // resource #2 of type curl
How can I get the instance count without calling var_dump()? Is it possible?
...
I have xdebug configured as shown below but the error-output is totally unreadable.
Do you have an idea what's wrong with the setup?
TIA & best regards
Setup: Apache/2.2.13 (Unix) PHP/5.3.0 on Snow Leopard Server
Config from php.ini:
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_host=10.0.1.9
xdebug.remote_connect_ba...
Every decent programmer has a print_r or var_dump wrapper they use, love and assign shortcut keys to, why don't we share our favourite ones.
I am using a simple one, here:
function dump($var = null) {
static $dumpId = 0;
if($dumpId == 0) {
echo '<style>pre {margin: 0px; text-align: left; color: #000; padding: 0px; font...
I have a var dump of unserialized data that looks like this
array(3) { ["product_options"]=> array(1) { [594]=> string(4) "2497" } ["is_edp"]=> string(0) "" ["base_price"]=> float(17.99) }
Can anyone help me get the data out of this array. I specifically need to access the [594] and get it to print out 2497. Any solutions or advi...
EDIT: (UPDATED)
Maybe my question was not clear enough. Ok, lets put it this way:
$arr["a"] = 10;
var_dump($arr);
$arr["b"] =& $arr["a"];
var_dump($arr);
the first var_dump returns:
array
'a' => int 10
While the second one returns:
array
'a' => &int 10
'b' => &int 10
If I unset($arr["a"]) it will return:
array
'b' => ...
A jQuery AJAX request .post()s data to page.php, which creates $res and var_dump()s it.
$res:
$res = array();
foreach ($_REQUEST as $key => $value) {
if($key){
$res[$key] = $value;
}
}
var_dump($res):
array(4) {
["text1"]=> string(6) "mattis"
["text2"]=> string(4) "test"
["tu"]=> string(32) "deb6adbbff4234b...
I know (PHP's) var_dump is supposed to be "human readable" and all, but analyzing large objects is just a pain in the neck. I am struggling to make sense of a few of the large objects that are being passed around in a script that we are running. (I know that using xdebug with and IDE is a good idea, but I have not been able to get xdebu...
Hello
I'm having some issue with var_dump.i'm using xampp 1.7.3 on windows.
I think in previous version i could output a variable with var_dump without print "<pre>" print "</pre>" firebug is not installed on my firefox and i'm not using xdebug.
Formally i have even red colored and nicely formatted output.Now it's completly unre...
Hi,
Is it possible to hide a specific class fields from print_r ?
<?php
class DataManager {
public $data = array();
}
class Data {
public $manager;
public $data = array();
public function Data ($m, $d) {
$this->manager = $m;
$this->data = $d;
}
}
$manager = new DataManager();
for ($a = 0; $a < 1...
I'm having this problem with validating a document that contains some basic PHP variables. Mainly I'm using html's h1, h2, and pre codes for formatting the text.
My problem is that when I validate the document, it comes out with an error.
The problem area is this part of the file:
<h2>Server Info</h2>
<pre>
<?php
echo $_SERVER;
prin...
Hi. I used var_dump on an object in my code. print var_dump( $$user);
result: object(stdClass)#35 (1) { ["user1_ready"]=> string(1) "0" } How do I get to this value (0 in this case).
I tried print $$user which resulted in Catchable fatal error: Object of class stdClass could not be converted to string in
I need something like if($...
When I var_dump an object, the output looks like this:
object(XCTemplate)#2477 (4) {
["id"]=>
string(1) "1"
["attributes"]=>
array(0) {
}
["db_table_name"]=>
string(14) "template_names"
["cache"]=>
array(0) {
}
}
XCTemplate is its class, of course, but what does the integer (here: 2477) after the # mean?
...