Q:

if function returns string do something | PHP

This is my function:
function getCinemaName($id) {
    $shows = getShowList();

    foreach ($shows as $filmDetails) {

        if ($id == $filmDetails->EventID) {
            if (preg_match('/On/', $filmDetails->AuditoriumShortName)) {
                return 'Cinema One';
                break;
            }
            if (preg_match('/Tw/', $filmDetails->AuditoriumShortName)) {
                return 'Cinema Two';
                break;
            } 
        }
    }
}

Now I want the IF-Statement to do something, if the function returns a specific String.
So is it possible to write something like this:
if (getCinemaName('Cinema One')){
    echo"Do something";
}

Thank you!

A:

Quite simple:
if (getCinemaName($id) === 'Cinema One' ){
    echo "Function returned 'Cinema One' value";
}

Also you can read about it some more here:
http://php.net/manual/en/language.operators.comparison.php
and here: http://php.net/manual/en/control-structures.if.php

