3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "Ham followed now ecstatic use speaking exercise may repeated. Himself he evident oh greatly my on inhabit general concern. It allowance prevailed enjoyment in it. Calling observe for who pressed raising his. Can connection instrument astonished unaffected his motionless preference. Announcing say boy precaution unaffected difficulty alteration him."; $word = "Potato"; $needleCharCounts = count_chars(strtolower($word), 1); $haystackCharCounts = count_chars(strtolower($text), 1); $result = null; foreach ($needleCharCounts as $letter => $count) { $result = min($result ?? PHP_INT_MAX, intdiv($haystackCharCounts[$letter] ?? 0, $count)); echo "$result :: " . chr($letter) . ": $count versus " . $haystackCharCounts[$letter] . "\n"; if ($result === 0) { break; } } echo $result ?? 0; // "a" can be found 22 times. // "o" can be found 20 times, so two "o"s can be found 10 times. // "p" can be found 6 times. // "t" can be found 20 times, so two "t"s can be found 10 times.
Output for git.master_jit, git.master, rfc.property-hooks
22 :: a: 1 versus 22 10 :: o: 2 versus 20 6 :: p: 1 versus 6 6 :: t: 2 versus 20 6

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
46.04 ms | 405 KiB | 5 Q