print-r

Which php variable debugging function do you use? var_dump, print_r, var_export, other?

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? ...

What is Perl's equivalent to PHP's print_r()?

I find print_r in PHP extremely useful, but wonder if there is anything remotely equivalent in Perl? ...

PHP eval error when assigning value to variable

Hello, all SO users! I have a bit of PHP code (for the module feature of my CMS (not drupal) which allows people to view pages, comments, forum posts, blog posts, etc...): if(isset($_GET["m"])) { //Does the module exist and activated, and has it a function called view? if(isset($module_exists[$_GET["m"]]) && method_exists($_GET...

PHP print_r and static member

I've got an instance of a DB object that's passed to a Session object, because the Session object has several methods that make use of DB object to execute SQL statements I had plan to store this DB object in Session object property. Through testing I found that print_r exposed the DB object stored in the Session object property; includ...

print_r to get object methods in PHP?

I'm working with Views 2 in Drupal 6, and I am having difficulty finding documentation on the methods of the View object. Is there any PHP function like print_r that outputs methods as well as fields? ...

php print_r nice table

Hi there I'm looking to be able to produce a nicely formatted table with rows and columns from the contents of a print_r array statement? Any ideas? ...

Flash trace,dump,print Array variables

is there a way to trace an ARRAY in FLASH. I want to have an output similar to PHPs command:print_r(myArray) for ex: (in flash): var event:Array = new Array(); event['name']='david'; trace(event); // that display anything while print_r(event) in PHP would display as string: Array { ['name'] => david, } I want to achieve same ki...

What's the difference of echo,print,print_r in PHP?

I use echo and print_r much,almost never use print. I feel echo is a macro,and print_r is alias of var_dump. But that's not the standard way to explain the difference. ...

Why do I get "Resource id #4" when I apply print_r() to an array in PHP?

Below is the code: $result=mysql_query("select * from choices where a_id='$taskid'")or die(mysql_error()); print_r($result); I get "Resource id #4", any idea? After I added while($row=mysql_fetch_assoc($result)) { print_r($row); } I just got [] What's wrong? ...

Why did I only got [] from print_r($row); in PHP?

Below is the code: $result=mysql_query("select * from choices where a_id='$taskid'")or die(mysql_error()); while($row=mysql_fetch_assoc($result)) { print_r($row); } Why did I only got []? What's wrong? More: It can not be empty. The more complete code is as follows: $result=mysql_query("select * from choices where a_id='$taskid'")or...

print_r functionality in iPython

Is there a way to get PHP-like 'print_r(object)' funcionality in iPython? I know I can use '?' to get info about an object, but how do I view the values of the object? ...

how do you write a function like print_r() that recursively prints objects?

i want to write a function that prints multi-dimensional objects which are text (or integers, etc.) into <span></span> tags and arrays into unordered lists. how do you make the function work recursively so that it prints everything regardless of what level it's at in the object? thanks! ...

Print and array to a file..

Hi, I would like to print an array to a file. I would like the file to look exactly similar like how a code like this looks. print_r ($abc); assuming $abc is an array. Is there any one lines solution for this rather than regular for each look. P.S - I currently use serialie but i want to make the files readable as readability is qui...

PHP, print_r($_SESSION) doesn't show its content ?

hi, I want to see the content of the the array $_SESSION with the command print_r($_SESSION) but what I get is just the following output: Array () what am I missing ? thanks ...

Hide specific class fields from print_r or var_dump

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...

PHP - SimpleXML - echo / print_r return different values.

I am trying to convert some xml into a json object using PHP. This should be working, yet for some bizarre reason it is failing. Could someone provide some input. // Loop Through images and return the right one. $i = 1; foreach($page->image as $image) { if ($i == $_GET['id']) { echo json_encode(array( 'backgro...

print_r not understanding a portion of the output.

I run a print_r command on $_POST and I am getting the following response: s:1289:"Array ( [id_master] => 12 [id_controller] => 4 [JSON] => {"uuid":"i~b1dad2c95c3efdc8521c84cd2891084289b9754b","relsno":102} )"; Any idea what the s:1289: is? ...

PHP: Problems finding the most frequent character in a UTF-8 string (eg 唐犬土用家犬尨犬山桑)?

From an MySQL database I can extract the following utf-8 characters: "唐犬土用家犬尨犬山桑山犬巴戦師子幻日幻月引綱忠犬愛犬戌年成犬教条教義" I am trying to find the most frequent character in this string. I tried putting each as element into an array $arr and do array_count_values($arr); Unfortunately the array operations (or is print_r the culprit?) produce mis-encoded...