Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8221207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:49:37+00:00 2026-06-07T13:49:37+00:00

ok i do have this following codes <?php ob_start(); ?> codepad is an online

  • 0

ok i do have this following codes

<?php
ob_start();
?>
codepad is an 
online compiler/interpreter, 
and a simple collaboration tool.
Paste 

your code below, 
and codepad wi
ll run 
it and give you a short 
URL you can use to share
 it in chat or email
<?php
$str = str_replace('\r\n','',trim(ob_get_clean()));
echo $str;
?>

and you can see how it works here
http://codepad.org/DrOmyoY9

now what i want here is to remove the newlines from the stored output of the ob_get_clean().

I almost looked around the internet on how to remove newlines in the strings and that’s the common and fastest method to remove the newlines aside from using the slowly preg_replace().

Why this happens? is this already a bug? or i just missed something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:49:38+00:00Added an answer on June 7, 2026 at 1:49 pm

    \r\n is windows style, but if the user using linux or mac, it would be different . so best solution is:

    $str = str_replace(array("\r","\n"),'',trim(ob_get_clean()));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: if (include_once(dirname(__FILE__).'/file.php') || include_once(dirname(__FILE__).'/local/file.php') ) { This causes an
i have the following code : <input type=text value=<?php echo $_GET['msg']; ?>> This input
I have the following jquery code: jQuery(function(){ jQuery(select#rooms).change(function(){ var options = ''; jQuery.getJSON(/admin/selection.php,{id: jQuery(this).val(),
I have this following codes: @implementation MyImageView @synthesize image; //image is a UIImage -
I have following codes using smarty template engine In php file: $smarty-&gt;assign('SITE_URL', 'http://localhost/mis/'); In
I have a notification system that works with the following codes jQuery: $(document).ready(function(){$.get('/codes/php/nf.php', function(data)
I have this following code, here CssClass is of the String type. <asp:Panel ID=Panel1
I have this following code which will return all the current semesters. How do
I have this following jquery text fly-in animation.Here is my code before I explain
Never thought I'd have this problem :) The following snippet of code works in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.