Well its no wonder you can't decipher this...Your buddy is using one of the most advanced programming technique ther is... it's called obfuscation... that and the technique called not-documenting-you-code-one-damned-bit are two of the techniques that take years of training under the master on mt. wu-tang to achieve... i will however break the code of silence below
ok lets take a closer look at an arguably better formatted version of your code
first off there is no comma in your if statement... it belongs to one of the sub calls that is inside your if statement
instead of writing out the stuff in my second example... the previous programmer decided (rightly so) that it was just more efficient and took up less room in his script if he combined everything in one go.... this however is another technique which when translated into english from machine code come out to roughly... look-at-me-im-an-asshole-to-whoever-comes-next-by-writing-confusing-code
in the second example ive made each function call into a link with which you can read up on the function....
$formats = array( 'jpg', 'png', 'bmp' );
if ( in_array(
strtolower(
substr( $_FILES[img1][name],
-3)
),
$formats
)
)
{
print ("if worked");
} else {
print ("else worked");
}
you could break this up more better like for looking if we did this
$allowed_formats = array( 'jpg', 'png', 'bmp');
$last_three_chars = [man]substr[/man]( $_FILES[img1][name], -3 );
$lowecase_file_extension = [man]strtolower[/man]( $last_three_chars );
$is_in_our_list_of_allowed_formats = [man]in_array[/man]( $lowercase_file_extension, $formats );
if ( $is_in_our_list_of_allowed_formats )
{
print ("if worked");
} else {
print ("else worked");
}