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 echo "題目一\n"; $ABC="php is great"; echo strtoupper($ABC)."\n"; echo str_replace("php is great","PHP IS AWESOME",$ABC)."\n"; echo "題目二\n"; $students = ["Ethan Caldwell", "Lucas Harper", "Mason Bennett"]; function getSingleNameLength(string $name) { $nameNoSpace = str_replace(" ", "", $name); return strlen($nameNoSpace) ; } function getStudentsNameLength(array $students) { $Length=[]; foreach($students as $Sname) { $Length[$Sname]=getSingleNameLength($Sname); } Return $Length; } function appendStudentCount(array $studentsNameLength) { $SNL=getStudentsNameLength($studentsNameLength); $SNL['student_count']=count($SNL); Return $SNL; } print_r (appendStudentCount($students)); echo "題目三\n"; $schema = 'https'; $host = 'example.com'; $path = 'v1/api/doge/transactions'; $query =['page' => 1, 'per_page' => 15]; $queryString = http_build_query($query); $fullUrl = sprintf("%s://%s/%s?%s", $schema, $host, $path, $queryString); echo $fullUrl;
Copy Clear