You can read about it in Alternative syntax for control structures in the PHP manual. Reformatted, the code you posted looks like this:
if (preg_match('/foo.*bar/','foo is a bar')):
echo 'success ';
echo 'foo comes before bar';
endif;
This code is equivalent to:
if (preg_match('/foo.*bar/','foo is a bar')) {
echo 'success ';
echo 'foo comes before bar';
}
This syntax is available for several other control structures as well.
if ( condition ):
// your if code
elseif ( other_condition ):
// optional elseif code
else:
// optional else code
endif;
while ( condition ):
// your while code
endwhile;
for ( condition ):
// your for code
endfor;
foreach ( condition ):
// your foreach code
endforeach;
switch ( condition ):
// your switch code
endswitch;