Jump to content

PHP Parse Error!?


Aaron_Escobar

Recommended Posts

Hi everyone. I've been recently developing a small script for converting videos with PHP and FFMPEG. Everything was great until when I had to specify the new file each file was going to have after being converted. The file name had to be intact but the extension had to change. The code was working but only with two or three format definitions. When I added more arrays in the "Define Extensions" section of my code, I ended up with a PHP parse error!  ???

Parse error: parse error, expecting `')'' in G:\Escobar Studios\httpdocs\pages\converter_process.php on line 38

 

Here's the code I was using for the extensions definitions:

 

//Important
$ext=pathinfo(LE_VIDEO);
$ext=strtolower($ext['extension']);

//Define Extensions
$asf=array('asf');
$avi=array('avi');
$flv=array('flv','f4v', 'f4p', 'f4a', 'f4b');
$mkv=array('mkv','mka', 'mks');
$mp4=array('mp4');
$mpeg=array('mpg', 'mpeg');
$mpeg=array('wma);


//Inital Value of type
$type='';

//Define Extensions and group them into formats

if (in_array($ext,$asf)) $type='ASF Video';
if (in_array($ext,$avi)) $type='AVI Video';
if (in_array($ext,$flv)) $type='Flash Video';
if (in_array($ext,$mkv)) $type='Matroska Video';
if (in_array($ext,$mp4)) $type='MP4 Video';
if (in_array($ext,$mpeg)) $type='MPEG Video';
if (in_array($ext,$wma)) $type='WMA Audio';

//SAY OUT-LOUD WHAT FORMAT IT WAS!
echo "The video was of" . $type . "type!";

 

What is weird is that the code only works with 2 or 3 definitions!  :'(

e.g., Only with...

 

$asf=array('asf');

$avi=array('avi');

 

but not with...

 

$asf=array('asf');

$avi=array('avi');

$flv=array('flv','f4v', 'f4p', 'f4a', 'f4b');

$mkv=array('mkv','mka', 'mks'

 

 

I've googled everything, yet NOTHING! Anybody know what's going on here? Or maybe you know an easier why to switch extensions in the output?

Link to comment
https://forums.phpfreaks.com/topic/152735-php-parse-error/
Share on other sites

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.