Laravel 8 replaceArray {#collection-method}

2021-07-19 10:34 更新

replaceArray 方法按照数组顺序使用其值替换字符串的指定部分:

use Illuminate\Support\Str;

$string = 'The event will take place between ? and ?';

$replaced = Str::of($string)->replaceArray('?', ['8:30', '9:00']);

// The event will take place between 8:30 and 9:00 
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号