Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

193
Vistas
How to do match exactly the content using PHP?

I need to match two string using PHP. Here is my code:

<?php

$fistno="9937229853";
$secondno="+919937229853";

?>

Here I need the value in $fistno is present in $secondno or not. If the value in $fistno is present in $secondno it will return true. In this case 9937229853 is present in $secondno so it should return true.

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Use strpos, see here.

if (strpos($mystring, $findme) === false) {

    return false;
}

return true;

Be careful and use === false as the string position in the other string can be 0 which when using == will evaluate to false when it is actually true.

over 4 years ago · Santiago Trujillo Denunciar

0

Use strpos

if (strpos($fistno, $secondno) !== false) {
    echo 'true';
}
over 4 years ago · Santiago Trujillo Denunciar

0

You need to use == not just =

$check = 'this is a string 111';
if (strpos($mystring, $findme) === false) {
    echo 'perfect match';
} 
else {
    echo 'it did not match up';
}

= will assign the variable.
== will do a loose comparison.
=== will do a strict comparison.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda