<?php

function test($re1, $re2) {
        if (preg_match($re1,$re1)) {
                echo "$re1 self-matches\n";
        }
        if (preg_match($re2,$re2)) {
                echo "$re2 self-matches\n";
        }

        if (preg_match($re1, $re2) && preg_match($re2, $re1)) {
                echo "$re1 and $re2 works\n";
        }
        else echo "$re1 and $re2 doesn't work\n";
}

test('/A$/', '/.A/A');
