3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * SIMPLE JWT TOKEN GENERATOR FOR C# API GATEWAY * * Quick setup: * 1. Run: composer install * 2. Update the $clientSecret variable below * 3. Run: php simple_jwt_example.php */ require_once 'vendor/autoload.php'; // ======================================== // CONFIGURATION (Match your Program.cs) // ======================================== $issuer = "https://abc.com/authservice"; $audience = "https://abc.com/megamart"; $clientSecret = "YOUR_SECRET_KEY_HERE"; // ⚠️ MUST MATCH Line 5 in Program.cs! // ======================================== // CREATE TOKEN // ======================================== $payload = [ 'iss' => $issuer, // Issuer 'aud' => $audience, // Audience 'iat' => time(), // Issued at 'nbf' => time(), // Not before 'exp' => time() + (60 * 60), // Expires in 1 hour // Custom claims (your user data) 'sub' => '12345', // User ID 'name' => 'John Doe', 'email' => 'john.doe@example.com', 'role' => 'Admin' ]; $jwt = JWT::encode($payload, $clientSecret, 'HS256'); // ======================================== // OUTPUT // ======================================== echo "JWT Token Generated:\n"; echo "====================\n\n"; echo $jwt . "\n\n"; ?> <?php /** * SIMPLE JWT TOKEN GENERATOR FOR C# API GATEWAY * * Quick setup: * 1. Run: composer install * 2. Update the $clientSecret variable below * 3. Run: php simple_jwt_example.php */ require_once 'vendor/autoload.php'; use Firebase\JWT\JWT; // ======================================== // CONFIGURATION (Match your Program.cs) // ======================================== $issuer = "https://abc.com/authservice"; $audience = "https://abc.com/megamart"; $clientSecret = "YOUR_SECRET_KEY_HERE"; // ⚠️ MUST MATCH Line 5 in Program.cs! // ======================================== // CREATE TOKEN // ======================================== $payload = [ 'iss' => $issuer, // Issuer 'aud' => $audience, // Audience 'iat' => time(), // Issued at 'nbf' => time(), // Not before 'exp' => time() + (60 * 60), // Expires in 1 hour // Custom claims (your user data) 'sub' => '12345', // User ID 'name' => 'John Doe', 'email' => 'john.doe@example.com', 'role' => 'Admin' ]; $jwt = JWT::encode($payload, $clientSecret, 'HS256'); // ======================================== // OUTPUT // ======================================== echo "JWT Token Generated:\n"; echo "====================\n\n"; echo $jwt . "\n\n"; ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.10.0090.01218.62
8.5.00.0230.00716.45
8.4.160.0360.01119.66
8.4.150.0360.01119.76
8.4.140.0380.01117.63
8.4.130.0340.01117.54
8.4.120.0370.01117.83
8.4.110.0370.01317.86
8.4.100.0390.00817.71
8.4.90.0360.00917.94
8.4.80.0400.00817.68
8.4.70.0370.00817.60
8.4.60.0380.00817.87
8.4.50.0380.01117.73
8.4.40.0370.01017.90
8.4.30.0390.01017.65
8.4.20.0400.01217.67
8.4.10.0390.00817.73
8.3.290.0350.00918.33
8.3.280.0350.01018.30
8.3.270.0380.00917.38
8.3.260.0330.01116.44
8.3.250.0360.00816.74
8.3.240.0360.00916.51
8.3.230.0360.01116.57
8.3.220.0410.00816.59
8.3.210.0380.00916.54
8.3.200.0380.01016.67
8.3.190.0420.00916.63
8.3.180.0390.01116.69
8.3.170.0400.01116.78
8.3.160.0410.00916.74
8.3.150.0390.00916.82
8.3.140.0380.01016.72
8.3.130.0350.00717.65
8.3.120.0360.00816.75
8.3.110.0370.00716.67
8.3.100.0380.00816.55
8.3.90.0360.00916.66
8.3.80.0380.00616.58
8.3.70.0340.01116.69
8.3.60.0410.01116.69
8.3.50.0340.01016.64
8.3.40.0360.01017.91
8.3.30.0270.01017.86
8.3.20.0270.01117.92
8.3.10.0280.01018.81
8.3.00.0220.00918.82
8.2.300.0420.01417.83
8.2.290.0300.01016.89
8.2.280.0270.01216.51
8.2.270.0330.00916.61
8.1.340.0360.00917.54

preferences:
36.01 ms | 403 KiB | 5 Q