RE: [PHP] require() vs include()

From: Date: Thu, 14 Mar 2002 23:56:46 +0000
Subject: RE: [PHP] require() vs include()
Groups: php.general 
Request: Send a blank email to php-general+get-88597@lists.php.net to get a copy of this message
They are much the same, both "include" a file. To quote the PHP manual "require() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, don't hesitate to use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Be sure to have an appropriate include_path setting as well." That said I would use require_once and include_once instead of just include and require, these functions ensure the file is only included once which prevents a lot of problems. Jason -----Original Message----- From: David McInnis [mailto:david@dataovation.com] Sent: Thursday, March 14, 2002 4:47 PM To: php-general@lists.php.net Subject: [PHP] require() vs include() Are these redundant functions or are they different? I seem to be able to use the interchangeably. David McInnis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#88597) next »