Php 는 하위 문자열 찾기

코드 예제

10
0

php 의 strpos


<?php
$mystring = 'abc';
$findme   = 'a';
$pos = strpos($mystring, $findme);

// Note our use of ===.  Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
    echo "The string '$findme' was not found in the string '$mystring'";
} else {
    echo "The string '$findme' was found in the string '$mystring'";
    echo " and exists at position $pos";
}
?>

5
0

php 문자열 포함

$mystring = 'abc';
$findme   = 'a';
$pos = strpos($mystring, $findme);
3
0

php 문자열에서 찾거나

$a = 'How are you?';

if (strpos($a, 'are') !== false) {
    echo 'true';
}
1
0

php 바늘 건초 더미

//Find the position of the first occurrence of a substring in a string
$mystring = 'abc';
$findme   = 'a';
$pos = strpos($mystring, $findme);
1
0

strpos php


<?php
$mystring = 'abc';
$findme   = 'a';
$pos = strpos($mystring, $findme);

// El operador !== también puede ser usado. Puesto que != no funcionará como se espera
// porque la posición de 'a' es 0. La declaración (0 != false) se evalúa a 
// false.
if ($pos !== false) {
     echo "La cadena '$findme' fue encontrada en la cadena '$mystring'";
         echo " y existe en la posición $pos";
} else {
     echo "La cadena '$findme' no fue encontrada en la cadena '$mystring'";
}
?>

0
0

php 는 문자열에서 문자열 찾기

$pos = strpos("find the position of X in here", "X");

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................