Jump to content

using the glob function with a $ function


carlosx2

Recommended Posts

I had this all figured out and it worked too. I am using the get function to get a variable from the url, that will be used by glob function to scan a folder on the server and return an array that i will use for people to download movies. but because the variable i got from the url has several characters that are not corresponding with the folder on the server i came up with a simple way to filter them out and be left with a first and last name that would math with the first and last name and a space just like the folder name on my server. 

 

So i thought i had this all figured out on my own but then i saw that function that is holding the first and last name and space just i need it to be, isn't working when i put it in the glob function.

 

So my question is how do you add functions to a glob path.

 

Here is the code

$model = $_GET['id'];
$movie = glob("components/content/videos/downloads/$path/*.jpg");
$filename = (explode (":",$model));
$filename2 = (explode ("-",$filename[1]));
$space = " ";
$path = $filename2[0]. $space . $filename2[1];

 

this only part of the code. but it all happens in the part.

 

Who can tell me how to approach this?

Link to comment
https://forums.phpfreaks.com/topic/177094-using-the-glob-function-with-a-function/
Share on other sites

$model = $_GET['id'];
$movie = glob(functionToUse()."components/content/videos/downloads/$path/*.jpg");
$filename = explode(":",$model);
$filename2 = explode("-",$filename[1]);
$space = " ";
$path = $filename2[0]. $space . $filename2[1];

 

. is the concatenation operator you can use it in conjunction with functions aswell as variables.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.