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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:24:14+00:00 2026-05-12T16:24:14+00:00

I am new to php and wondering if I can have something like this:

  • 0

I am new to php and wondering if I can have something like this:

<?php
 ...
 magicFunctionStart();
?>

<html>
   <head>...</head>
   <body>...</body>
</html>

<?php
 $variable = magicFunctionEnd();
 ...
?>

What I have to use right now is

<?php
 ...
 $variable = "<html><head>...</head><body>...</body></html>"
?>

Which is annoying and not readable.

  • 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-12T16:24:15+00:00Added an answer on May 12, 2026 at 4:24 pm

    Have you tried “output buffering”?

    <?php
     ...
     ob_start();
    ?>
    
    <html>
       <head>...</head>
       <body>...<?php echo $another_variable ?></body>
    </html>
    
    <?php
     $variable = ob_get_clean();
     ...
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i'm new to php and mysql. I'm wondering how can i use PHP
Im new to PHP and I was wondering how I can overcome this seemingly
I'm new to PHP but was wondering how this can be done. I want
I am new to OO php so this may seem basic.. Basically I have
New to PHP and MySQL, have heard amazing things about this website from Leo
I'm fairly new to php and was wondering how do I validate the array
I am new to php and was wondering if anybody could help me with
I am somewhat new to PHP, and I am wondering: How important is it
Rather new to php, so sorry if this seems stupid. I'm really copying a
Im new to PHP and I can't figure out what the rules are for

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.