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

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

Copy Clear
Copy Format Clear
<?php //ex1 $ex1 = "php is great"; echo strtoupper(str_replace("great","awesome",$ex1)); //ex2 $ex2 = ['Ethan Caldwell','Lucas Harper','Mason Bennett']; function getSingleNameLength(string $name):int { return strlen(str_replace(' ','',$name)); } function getStudentsNameLength(array $students):array { $ret = []; foreach ($students as student) { ret[student] = getSingleNameLength(student); } return ret; } echo getSingleNameLength(str_replace(' ', '','Ethan Caldwell')); echo getStudentsNameLength($ex2);
Copy Clear