shergold Posted July 8, 2009 Share Posted July 8, 2009 Hey, i was just wondering how i use the asterisk to mean all. for example if i want to do the following if ($file == "*.txt" || $file == "*.exe") unlink $file; I have tried this without success. ??? Thanks, Shergold. Link to comment https://forums.phpfreaks.com/topic/165264-solved-how-to-use/ Share on other sites More sharing options...
p2grace Posted July 8, 2009 Share Posted July 8, 2009 Try this: if (strstr($file,".txt") || strstr($file,".exe"){ unlink($file); } Link to comment https://forums.phpfreaks.com/topic/165264-solved-how-to-use/#findComment-871535 Share on other sites More sharing options...
shergold Posted July 8, 2009 Author Share Posted July 8, 2009 thanks allot , works perfectly although you did miss the last parenthesis off the if statement by the way for future reference how would i use the * in php? Thanks allot, shergold. Link to comment https://forums.phpfreaks.com/topic/165264-solved-how-to-use/#findComment-871539 Share on other sites More sharing options...
p2grace Posted July 8, 2009 Share Posted July 8, 2009 The way I just showed you... php doesn't honor the asterisk, only sql does. You of course can use it in sql queries from php, but the php code itself won't interpret it. Link to comment https://forums.phpfreaks.com/topic/165264-solved-how-to-use/#findComment-871541 Share on other sites More sharing options...
shergold Posted July 8, 2009 Author Share Posted July 8, 2009 Ok thanks allot, also is there a php function to move files from one directory to another? edit: i searched in google before i posted but couldnt find one. Thanks again, Shergold. Link to comment https://forums.phpfreaks.com/topic/165264-solved-how-to-use/#findComment-871543 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.