Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$text = 'balllooon';
$text = preg_replace("/[^ablon]/",'',$text);
$arr = str_split($text);
$counter = array_count_values($arr);
$counter['a'] = $counter['a'] ?? 0;
$counter['b'] = $counter['b'] ?? 0;
$counter['l'] = floor($counter['l']*0.5) ?? 0;
$counter['o'] = floor($counter['o']*0.5) ?? 0;
$counter['n'] = $counter['n'] ?? 0;
print_r($counter);
print_r(min($counter));