Search code examples
phpfilefunctionincludedie

How to include files with die(); function?


file1.php and file2.php with die(); function.

include.php:

<? include 'file1.php';
include 'file2.php' ?>

file1.php

<? echo 'included'; die(); ?>

file2.php

<? echo 'not included'; die(); ?>

How can I include both files with die(); function?


Solution

  • If I understand correctly what you are trying to do then unfortunately it isn't possible.

    die(); will stop the script from executing at the point from where it is called.