<?php substr_count( string $haystack, string $needle, int $offset = 0, ?int $length = null): int
<?php public static function substrCount($haystack, $needle, $offset = 0, $length = null) { if (! is_null($length)) { return substr_count($haystack, $needle, $offset, $length); } return substr_count($haystack, $needle, $offset);
<?php return substr_count($haystack, $needle, $offset, $length); } return substr_count($haystack, $needle, $offset); }
<?php $query = EloquentTestUser::has('postWithPhotos'); $bindingsCount = count($query->getBindings()); $questionMarksCount = substr_count($query->toSql(), '?'); $this->assertEquals($questionMarksCount, $bindingsCount); }