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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:01:33+00:00 2026-05-23T18:01:33+00:00

im working with a large team, and im making functions that return html code,

  • 0

im working with a large team, and im making functions that return html code, and im echoing the result of those functions to get the final page. The thing is, i need some scrap of code developed by other member of the team, and i need it to be a string, but the code is available as a php file which im supposed to include or require inside my page.

Since im not writing an ht;ml page, but a function that generate that code, i need to turn the resulting html of the require statement into a string to concatenate it to the code generated by my function.

Is there any way to evaluate the require and concatenate its result to my strings?

Ive tried the function eval(), but didnt work, and read some thing about get_the_content(), but it isnt working either. I dont know if i need to import something, i think it have something to do with wordpress, and im using raw php.

thanks for all your help!!! =)

  • 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-23T18:01:34+00:00Added an answer on May 23, 2026 at 6:01 pm

    Try the ob_…() family of functions. For example:

    <?php
    
        function f(){
            echo 'foo';
        }
        //start buffering output. now output will be sent to an internal buffer instead of to the browser.    
        ob_start();
    
        //call a function that echos some stuff
        f();
    
        //save the current buffer contents to a variable
        $foo = ob_get_clean();
    
        echo 'bar';
        echo $foo;
    
        //result: barfoo
    
    ?>
    

    If you want to put the echo’d result of an include into a variable, you could do something like this:

    //untested
    function get_include($file){
        ob_start();
        include($file);
        return ob_get_clean();
    }
    

    or if you want to put the echo’d result of a function call into a variable, you could do something like this:

    //untested
    //signature: get_from_function(callback $function, [mixed $param1, [mixed $param2, ... ]])
    function get_from_function($function){
        $args = func_get_args();
        shift($args);
        ob_start();
        call_user_func_array($function,$args);
        return ob_get_clean();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm in a 10 person team working on a large legacy code base with
I am working with a team that works on a very large software project,
We're a small dev team working with some GLSL that may be too large
Our team is currently working on a large project which makes heavy use of
We're a distributed team of 5 developers working on rather large integrations project. We
I am currently working on a rather large project with a team distributed across
I'm working with large numbers that I can't have rounded off. Using Lua's standard
I've been working on a fairly large C++ project that surprisingly uses MS Access
I'm new to a team working on a rather large project, with lots of
I work in a large, separated development team. The project I'm currently working on

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.