Laravel  
laravel
文档
数据库
架构
入门
php技术
    
Laravelphp
laravel / php / java / vue / mysql / linux / python / javascript / html / css / c++ / c#

strpbrk php

作者:我视你如狗ㄟ   发布日期:2025-10-18   浏览:478

The strpbrk function in PHP is used to search a string for any of a set of characters. It returns a portion of the string starting from the first occurrence of any character from the given set.

Here is the syntax of the strpbrk function:

strpbrk(string $haystack, string $char_list): string|false

Parameters:

  • $haystack: The string to search in.
  • $char_list: A string containing the characters to search for.

Return value:

  • Returns a string starting from the first occurrence of any character from $char_list, or false if no character is found.

Example usage:

$haystack = "Hello World";
$char_list = "aeiou";

$result = strpbrk($haystack, $char_list);
echo $result; // Output: ello World

In the above example, the strpbrk function searches for any vowel character (a, e, i, o, u) in the $haystack string and returns a substring starting from the first occurrence of a vowel character.

上一篇:安装php7.3(安装php8)

下一篇:php strpos

大家都在看

php session用法

php 定义常量

phpisset函数

php html转图片

php后端

php爬虫框架

php读取csv文件

php+mysql动态网站开发

php 三元表达式

php文件加密

Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3

Laravel 中文站