Re: [PHP-ES] Comparar string y mostrar diferencia.

[email protected] (Mauricio Cuenca)
Newsgroups php.general.es
Message-ID <[email protected]>
<?php

$var1= "Esto es un texto";
$var2= "Esto es un texto y quiero ver esto";

if ($var1 != $var2) {
    echo substr($var2, strlen($var1), strlen($var2));
}


--
Mauricio


2010/1/22 Pablo Braulio <[email protected]>

> Hola a todos.
>
> Necesito porder comparar dos string y recoger (para mostrar) la diferencia.
>
> La comparación es fácil: $string1 == $string2.
>
> Pero la segunda parte es mas complicada y no se como hacerlo.
>
> Un ejemplo de lo que pretendo:
>
> $var1= "Esto es un texto";
>
> $var2= "Esto es un texto y quiero ver esto";
>
> if($var1 != $var2){
>        CODIGO QUE ME FALTA
> }
>
> Lo que tendría que mostrar es "y quiero esto".
>
> ¿Alguna idea?.
> --
> Saludos cordiales.
> Pablo.
>
> --
> PHP Spanish Localization Talk Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.