Yatko
Yatko

Reputation: 8805

Include php files the correct way

/* index.php */
require_once('region.php');
require_once('es.php');
/* index.php */
require_once('region.php');
/* region.php */
require_once('es.php');

Upvotes: 0

Views: 55

Answers (1)

Furkan ozturk
Furkan ozturk

Reputation: 722

I would include es.php into region.php

Because, region.php decide my language whether it is spanish or not. If it is not my language, i can change the language file

We suppose in region.php;

//region.php    
    if(myRegion()=="Turkey"){
      require_once('turkish.php');
    }else if(myRegion()=="Spania"){
      require_once('es.php');
    }

so we avoid unnecessary file loads

Upvotes: 1

Related Questions