Compare URL with PHP

0

I want to make a if to compare URLs, tried using parse_url ... but I'm not sure how to use it. Could someone help me?

<?php 
    $url1 = parse_url ( "http://enquetegoias.esy.es" ); 
    $url2 = parse_url ( "http://enquetegoias.esy.es/pesquisa.html" );
?>
<?php if ($url1['host']  == $url2['host'] ): ?>

        <meta property="og:image" content="http://enquetegoias.esy.es/img/logo.jpg" />

        <meta itemprop="image" content="http://enquetegoias.esy.es/img/logo.jpg" />

    <?php else: ?>

        <meta property="og:image" content="http://enquetegoias.esy.es/img/votacao.jpg" />

        <meta itemprop="image" content="<?=URL?>img/layout/votacao.jpg" />

    <?php endif ?>
    
asked by anonymous 17.07.2015 / 20:23

1 answer

1

strcmp( string $str1, string $str2 )

Get two strings as a parameter. Returns < 0 if $ str1 is less than $ str. Returns > 0 if $ str1 is greater than $ str2 and finally returns 0 if both strings are equal.

strcasecmp( string $str1, string $str2 )

Identical to the strcmp () function, with the difference that strcmp () is case sensitive, and the strcasecmp () function is not case sensitive.

    
17.07.2015 / 20:33