Jump to content

print_r automatically echos contents


cs.punk

Recommended Posts

Hey guys it's been a long time, but I am back with php!

 

Anyway here's my dilemma:

 

test.php

<?php
<?php
$name = array('Chris', 'Bob', 'Jack');

$names = print_r($name);
?>

 

Simple enough right? Well although I am not printing/echoing these results to screen it does it automatically.

 

Meaning when I point my browser to test.php it outputs this:

Array ( [0] => Chris [1] => Bob [2] => Jack ) 

 

Rather than only assigning the value to the $names variable, which is what I would expect it to do. Is this normal behaviour or is there something I can change on php.ini?

 

Thank you!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.