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

  • SEARCH
  • Home
  • 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 9225211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:31:16+00:00 2026-06-18T04:31:16+00:00

So say I have a file page.php <html> Hello <?php echo $world;?> </html> I

  • 0

So say I have a file page.php

<html>
Hello <?php echo $world;?>
</html>

I want to create a variable and assign it ‘Hello world’ using page.html

Something like

$world = 'world';
$mypage = parse_file('page.php');

I suppose I could wrap the entire file in doublequotes as such

$mypage="<html>
Hello $world
</html>";

but doublequote parsing is inefficient. Is there any easy of doing this without having to write a script that parses page.html?

  • 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-18T04:31:18+00:00Added an answer on June 18, 2026 at 4:31 am

    Output buffering will do this nicely

    ob_start();
    $world = 'world';
    include('page.php');
    $mypage = ob_get_clean();
    

    Reference:

    • ob_start()
    • 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 been using this rule: RewriteRule ^([^\.]+)/?$ index.php?page=$1 [L] Which will turn example.com/page/hello
I have three simple html or php file that I'm going to create. What
I have made one file say a.php. Now I want some thing like if
Say I have a binary file of 12GB and I want to slice 8GB
Say I have a data file that I want to process; I want to
Here is my issue: I have a login page called login.php (containing no HTML
Hello I have a jQuery function that will send to a php file some
I have some PHP and HTML in the same file, and I am not
Let's say you have a HTML file with a couple duplicate scripts, meaning multiple
Let's say I have a test.html file with some example content: <table> <tr> <td>'Test'</td>

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.