Is it better to use require_once('filename.php') or require_once 'filename.php';

Viewed 8542

Is this just a stylistic difference, or does using require_once('filename.php') vs require_once 'filename.php' have actual load/efficiency differences?

5 Answers

include, include_once, require and require_once are not functions, they are statements, that is why you should not use ().

Also, consider this from php.net:

<?php

// won't work
if (include('vars.php') == TRUE) {
    echo 'OK';
}

// works
if ((include 'vars.php') == TRUE) {
    echo 'OK';
}

?>
Related