3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tracking { #function __construct($client) {} function generateID($length) { $id = $client; $x = 0; while ($x < $length) { $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890123456789'; $id .= substr($chars, mt_rand(0, strlen($chars) - 1), 1); } return $id; } } $parcel = new Tracking(1426); echo $parcel->generateID(4);

preferences:
34.32 ms | 402 KiB | 5 Q