0

I have a function like this

function test()
{
    include("test.php");
}

echo test();

test.php

<?php
//echo 'test1';
return 'test2';
?>

echo 'test1' works but return 'test2' not works.

for me return nothing.

1
  • You're not returning anything from your function. Commented Aug 10, 2016 at 18:40

1 Answer 1

2

Yes, it is possible, but you would also need to return that value from the function:

function test()
{
    return include("test.php");
}

echo test();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.