Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 12-13-2013, 07:23 AM
klwm klwm is offline
Junior Member
 
Join Date: 10-09-13
Posts: 13
iTrader: 0 / 0%
print_r() output

PHP Code:
<?php
$a 
"test";
$x print_r($a);
echo 
$x;
?>
Could you please let me know why the output of the above script is:
41

Last edited by snakeair; 12-13-2013 at 07:27 AM.
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 12-13-2013, 07:44 AM
ScriptMan's Avatar
ScriptMan ScriptMan is offline
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 14,038
iTrader: 4 / 100%
Not my strong point. Perhaps this page will help. http://www.php.net/print_r

print_r is used for printing out arrays and your script does not contain one so anything can be going on.
 
Reply With Quote
  #3  
Old 12-16-2013, 08:56 PM
chrisranjana chrisranjana is offline
Junior Member
 
Join Date: 07-11-05
Location: Chennai India
Posts: 18
iTrader: 0 / 0%
Quote:
Originally Posted by klwm View Post
PHP Code:
<?php
$a 
"test";
$x print_r($a);
echo 
$x;
?>
Could you please let me know why the output of the above script is:
41
The Output is 41 or test1 ?
 
Reply With Quote
  #4  
Old 12-17-2013, 01:23 AM
williamforrest williamforrest is offline
Contributing Member
 
Join Date: 12-01-13
Posts: 98
iTrader: 0 / 0%
I tried your code the output is "test1" not "41".
"test" is the output of "print_r($a)"
"1" is the output of "echo $x" in which is the return of print_r that means TRUE;
 
Reply With Quote
  #5  
Old 12-20-2013, 01:40 PM
maxjeanes maxjeanes is offline
Contributing Member
 
Join Date: 11-27-13
Posts: 51
iTrader: 0 / 0%
try using
print_r(var_dump($x));

Also, echo "<pre>" before that line and echo "</pre>" afterwards to format the output correctly.

Last edited by snakeair; 12-20-2013 at 04:38 PM. Reason: merged posts - use the edit feature
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i get H.264 output in after effects? dtommy79 Graphic Design Forum 4 02-10-2013 11:54 AM
NMS Mail, Formatting output, etc. hotwired99 Coding Forum 0 08-30-2012 02:08 AM
Need some help with php output Newbe Coding Forum 3 09-05-2008 08:44 AM
Why does this not output? thenextbesthang Coding Forum 3 12-29-2006 12:31 PM
Need simple PHP date output.. POR-15 Depot Coding Forum 7 03-05-2004 01:15 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 06:28 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC