carlosx2 Posted October 9, 2009 Share Posted October 9, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/177094-using-the-glob-function-with-a-function/ Share on other sites More sharing options...
carlosx2 Posted October 9, 2009 Author Share Posted October 9, 2009 who can help me out. i know there are plenty of bright people here Quote Link to comment https://forums.phpfreaks.com/topic/177094-using-the-glob-function-with-a-function/#findComment-933762 Share on other sites More sharing options...
mikesta707 Posted October 9, 2009 Share Posted October 9, 2009 if your function returns the folder name you want, than just do $movie = glob(myReturnFunction()); Quote Link to comment https://forums.phpfreaks.com/topic/177094-using-the-glob-function-with-a-function/#findComment-933763 Share on other sites More sharing options...
RussellReal Posted October 9, 2009 Share Posted October 9, 2009 $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. Quote Link to comment https://forums.phpfreaks.com/topic/177094-using-the-glob-function-with-a-function/#findComment-933764 Share on other sites More sharing options...
carlosx2 Posted October 9, 2009 Author Share Posted October 9, 2009 i see yes. that's great. thanks Quote Link to comment https://forums.phpfreaks.com/topic/177094-using-the-glob-function-with-a-function/#findComment-933794 Share on other sites More sharing options...
carlosx2 Posted October 9, 2009 Author Share Posted October 9, 2009 ok i have no idea how to use this. it isn't working. it makes no sense to me. lol Quote Link to comment https://forums.phpfreaks.com/topic/177094-using-the-glob-function-with-a-function/#findComment-933801 Share on other sites More sharing options...
thebadbad Posted October 9, 2009 Share Posted October 9, 2009 In your sample code you're using $path before you've set it? Quote Link to comment https://forums.phpfreaks.com/topic/177094-using-the-glob-function-with-a-function/#findComment-933817 Share on other sites More sharing options...
carlosx2 Posted October 9, 2009 Author Share Posted October 9, 2009 so i should first set it and then call it into the path to fill in the blanks. is that right ? Quote Link to comment https://forums.phpfreaks.com/topic/177094-using-the-glob-function-with-a-function/#findComment-933840 Share on other sites More sharing options...
carlosx2 Posted October 9, 2009 Author Share Posted October 9, 2009 any more thoughts Quote Link to comment https://forums.phpfreaks.com/topic/177094-using-the-glob-function-with-a-function/#findComment-933866 Share on other sites More sharing options...
thebadbad Posted October 9, 2009 Share Posted October 9, 2009 Absolutely right. But why ask when you can try it out in like 1 sec? Quote Link to comment https://forums.phpfreaks.com/topic/177094-using-the-glob-function-with-a-function/#findComment-933885 Share on other sites More sharing options...
carlosx2 Posted October 9, 2009 Author Share Posted October 9, 2009 yeah that did the trick. that i didn't think of that. thanks Quote Link to comment https://forums.phpfreaks.com/topic/177094-using-the-glob-function-with-a-function/#findComment-933913 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.