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 6015883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:54:07+00:00 2026-05-23T02:54:07+00:00

My PHP code: include something.php $mysite = writeContent(); //footer.php ob_start(); echo <script…all my javascript

  • 0

My PHP code:

include "something.php"
$mysite = writeContent();

//footer.php
ob_start();
echo "<script...all my javascript here...</script>";
$object = ob_get_contents();
ob_end_clean();

$search = array("\n","\r");
$replace = array("","");
$object = str_replace($search, $replace, $object);
echo $object;

then my JavaScript is malformed and doesn’t work.

I know I can use gzip to increase the speed (thats not what I’m asking) but what I really want is to remove the extra space from the code.

  • 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-05-23T02:54:08+00:00Added an answer on May 23, 2026 at 2:54 am

    Any chance you’re having an issue with semicolons? You probably want to validate your JavaScript first to see what’s wrong, but here’s one of many possibilities:

    var foo = 0 // This works fine
    var bar = 1
    // #=>
    var foo = 0var bar = 1 // This doesn't
    
    // And FWIW, this is what you want:
    var foo = 0;
    var bar = 1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have put some php code in a sidebar-01.php i like in my template
For instance: // somefile.php function doSomething() { // do lots of code, whatever... return
I have an index page, I want it to include a page called splash.php
Does anyone have a PHP function that for example if a mysql_error() happens due
For some years that I've been using my own PHP template engine, which is
normally my ajax functions look something like this: function ajaxCallback(url,functionToRun) { if (window.XMLHttpRequest) {//
I am trying to build a php function that would return an array with
I'm having problems embedding php inside an html file. I first ran in to
I have a PHP authentication system on my website using the $_SESSION variable. A
I have a PHP generated form which consists of a list of items, each

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.