CKTIS / PHP
str_contains()
Preveri podniz bajtov na poljubnem mestu in razlikuje velikost črk.
Različica: PHP 8.4; repository runtime, production runtime not attested
Sintaksa
str_contains(string $haystack, string $needle): boolPreveri podniz bajtov na poljubnem mestu in razlikuje velikost črk. Logični rezultat razloči zadetek na mestu nič od neuspeha. Prazen vzorec je v vsakem nizu, tudi praznem.
Podpis
str_contains(string $haystack, string $needle): bool
Izhod primera
[true,false,true,true]
Primeri
<?php
echo json_encode([str_contains("Log.txt","Log"),str_contains("Log.txt","log"),str_contains("",""),str_contains("id","")]);
Rezultat
[true,false,true,true]