php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37404 Escape Sequences not Working
Submitted: 2006-05-11 09:20 UTC Modified: 2006-05-11 14:40 UTC
From: werty37 at gmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.1.5CVS OS: Ubuntu Dapper Drake Beta
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: werty37 at gmail dot com
New email:
PHP Version: OS:

 

 [2006-05-11 09:20 UTC] werty37 at gmail dot com
Description:
------------
I tried to use the escape syntax "\n" but php is not printing a newline. I also tried "\r" and "\t" but still no use.

The php version im using is:
PHP 5.1.2-1ubuntu2

Reproduce code:
---------------
<?php


$friends_list = array('Sujith','Kalesh','Sijin','Ridhul');

foreach($friends_list as $friends)
{
echo "Hello, $friends\n";
}

?>


Expected result:
----------------
Hello, Sujith
Hello, Kalesh
Hello, Sijin
Hello, Ridhul 

Actual result:
--------------
Hello, Sujith Hello, Kalesh Hello, Sijin Hello, Ridhul 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-11 09:34 UTC] tony2001@php.net
Newlines in HTML look like "<br/>".
 [2006-05-11 14:22 UTC] werty37 at gmail dot com
#This is what i found in an ebook on php
#############################################
$person = array('Edison', 'Wankel', 'Crapper');

foreach ($person as $name) {
       echo "Hello, $name\n"; 
    } 
##############################################
#This is what it is suppossed to print
#Hello, Edison
#Hello, Wankel
#Hello, Crapper
#But this is what it prints
#Hello, EdisonHello, WankelHello Crapper
 [2006-05-11 14:40 UTC] tony2001@php.net
Yes, this is correct for _shell_.
But I bet the book presumes you already know what HTML is and how to add a newline there.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 01:01:34 2025 UTC