chrysst
chrysst

Reputation: 357

Variable inside get_filenames function using CodeIgniter and PHP

With the following code I am trying to get the file name inside MY_PIC folder and then to print it but is not possible.

$this->load->helper('file');
$uid = 10;  
$files = get_filenames('./MAINDIRECTORY/<? echo $uid; ?>/MY_PIC');
print_r($files);

The only way to get the filename is the following:

$this->load->helper('file');    
$files = get_filenames('./MAINDIRECTORY/10/MY_PIC');
print_r($files);

Does any other way that can I use the variable $uid?

Upvotes: 2

Views: 419

Answers (1)

Yoluk
Yoluk

Reputation: 310

What you want here is to concat a string with a variable :

$uid = 10;
$files = get_filenames('./MAINDIRECTORY/' . $uid . '/MY_PIC');

Hope this help ;)

Upvotes: 2

Related Questions