Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
if($note >= 18 && <=20){ return "excellent"; } elseif($note >= 14 && <=17){ return "Bien"; } elseif($note >= 10 && <=13){ return "Passable"; } elseif($note <= 10){ return "Insuffisant"; } elseif($note <=0 && >20){ return "Note invalide"; }

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php function compterPrenomsCommencantPar($prenoms,$lettre){ $count = 0; foreach ($prenoms as $prenom){ if(substr(strtolower($prenom), 0, 1) == strtolower($lettre)){ $count ++; echo $prenom; } } $prenom = strtolower($prenom); return $count; } $prenoms = ["Alice", "alex", "Bob", "Amélie", "marc"]; echo compterPrenomsCommencantPar($prenoms, "a"); // 3 (Alice, alex, Amélie) ?>
Copy Clear