1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

PHP 文字列検索 str_contains()

Last updated at Posted at 2022-05-23

概要

  • PHPの文字列検索組み込み関数のstr_contains()を簡単にまとめる。

前提

組み込み関数 str_contains()

  • 公式ドキュメント

  • 検索対象文字列内に検索文字列が存在するかの確認

  • 戻り値

    • 検索対象文字列内に検索文字列が存在する: trueを返却
    • 検索対象文字列内に検索文字列が存在しない: falseを返却
  • str_contains(検索対象文字列, 検索文字列);
    
  • 実例

    <?php
    
    $str = 'hoge/fuga/piyo';
    
    $result = str_contains($str, 'fuga');
    
    // trueが出力される
    var_dump($result);
    
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?