php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42130 Echo / Print Statements using OOP place OOP before string
Submitted: 2007-07-28 02:16 UTC Modified: 2007-07-28 09:11 UTC
From: scott at truebluewc dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.3 OS: Linux
Private report: No CVE-ID: None
 [2007-07-28 02:16 UTC] scott at truebluewc dot com
Description:
------------
When using an echo, print or a combination of those statements with an OOP, the OOP function within an echo statement, and using an echo inside that function, causes that function's echo to be first outputed before the echo statement called originally. See below code.

Reproduce code:
---------------
class file - syrup.php
<?php
class syrup {
    function pancakes() {
        echo "syrup on my pancakes!";
    }
}
?>

main file - index.php
<?php
function __autoload($classname)
	{
    	include_once("$classname.php");
	}
echo "I love ".syrup::pancakes()."<br />";
echo "and I hate ".syrup::pancakes();
echo "<br />Actually.. I can't really decide!";

?>

Expected result:
----------------
I love syrup on my pancakes!
and I hate syrup on my pancakes!
Actually.. I can't really decide!

Actual result:
--------------
syrup on my pancakes!I love 
syrup on my pancakes!and I hate 
Actually.. I can't really decide!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-28 09:11 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Nov 29 06:00:01 2025 UTC