Search code examples
yiiparam

difference betwern require __DIR__ and __DIR__


i a new yii developer and i do not understand one thing. In common/config/params.php file, i have following code:

<?php
return [
    'adminEmail' => '[email protected]',
    'supportEmail' => '[email protected]',
    'user.passwordResetTokenExpire' => 3600,
    'regions' => require __DIR__ . '/region.php',
];

what is the difference between 'regions' => require __DIR__ . '/region.php', and 'regions' => __DIR__ . '/region.php',


Solution

  • In 'regions' => __DIR__ . '/region.php' regions will contain a string variable (path to region.php based on current dir)

    In 'regions' => require __DIR__ . '/region.php' regions will contain an object of region.php class