3v4l.org

run code in 300+ PHP versions simultaneously
<?php class mbe4 { // var $mbe4_username; // var $mbe4_password; // var $mbe4_clientid; // var $mbe4_serviceid; // var $mbe4_contentclass; // var $mbe4_url; function __construct($username, $password, $clientid, $serviceid, $url="https://billing.mbe4.de/widget/singlepayment") { $this->username = $username; $this->password = $password; $this->clientid = $clientid; $this->serviceid = $serviceid; $this->url = $url; } /* * Senden der Daten an mbe4. * params: * $amount: Die Transaktionssumme in EUR * $contentid: Die Art des zu Buchenden Contents. * 1: News/Info * 2. Chat/Flirt * 3. Game * 4. Klingelton * 5. Bild/Logo * 6. Videoclip * 7. Musikdatei * 8. Lokalisierung * 9. Voting * 10. Gewinnspiel * 11. Portal Zugang * 12. Software * 13. Dokument * 14. Ticket * 15. Horoskop * 16. Freizeit * 17. Unterwegs * 18. Finanzen * 19. Shopping * 20. E-Mail * 21. Spende * return: * Liefert ein Key/Value-Array zurück, welches per GET an mbe4 übertragen werden muss. * */ function create_transaction($id,$description="mbe4 payment", $amount, $contentclass=1, $returnurl,$urlencode=TRUE){ // Timestamp generieren $timestamp=date("Y-m-d")."T".date("H:i:s.000")."Z"; // Hashbase definieren $hashbase= $this->password . $this->username . $this->clientid . $this->serviceid . $contentclass . $description . $id . $amount . $returnurl . $timestamp; // hash erzeugen $hashparam=md5($hashbase); // Build the data array that will be translated into hidden form values. $data = array( // General parameters 'username' =>$this->username, 'clientid' => $this->clientid, 'serviceid' => $this->serviceid, 'contentclass' => $contentclass, 'description' => $description, 'clienttransactionid' => $id, 'amount' => $amount, // mbe4 wants ct, no eur 'callbackurl' => $returnurl, 'timestamp' => $timestamp, 'hash' => $hashparam, ); // Sollen die Werte mit urlencode() codiert werden? if($urlencode==TRUE){ foreach($data as $element){ $element= urlencode($element); } } return $data; } /* validate_transaction($mbe4_params) * Validierung der Zahlung. Dafür werden die von mbe4 übergebenen Parameter * plus das mbe4-Password hintereinander gehängt und eine MD5-Summe aus dem String erstellt. * params: * $mbe4_params: Key-Value-Array aus dem per GET übergebenen Parametern * return: * Response-Code, 0 bedeutet erfolgreiche Zahlung * */ function validate_transaction($mbe4_params, $mbe4_password) { // check hash Signierung $hashbase= $mbe4_password . $mbe4_params["transactionid"] . $mbe4_params["clienttransactionid"] . $mbe4_params["responsecode"] . $mbe4_params["description"] . $mbe4_params["subscriberid"] . $mbe4_params["operatorid"] . $mbe4_params["timestamp"]; if(md5($hashbase)!=$mbe4_params["hash"]){ return 999; // Parameter nicht korrekt oder manipuliert! } return $mbe4_params["responsecode"]; // Transaktionscode zurückgeben } function is_valid_responsecode($responsecode) { if($responsecode==0) return TRUE; else return FALSE; } function get_responsemsg_by_responsecode($responsecode){ switch($responsecode){ case 0: return('OK'); case 1: return('NOT FINAL – request was processed successfully but the answer is not final. (e.g. a TAN was sent to the subscriber and tan received must be called)'); case 2: return('authorization failed'); case 3: return('capture failed'); case 4: return('terminate failed'); case 5: return('refund failed'); case 6: return('prepair failed'); case 7: return('transaction failed'); case 8: return('subscription terminate failed'); case 101: return('invalid parameter'); case 109: return('transaction in wrong status'); case 110: return('wrong PIN'); case 111: return('too many PIN attempts - transaction closed'); case 112: return('subscriber aborted transaction'); case 113: return('no route to operator'); case 121: return('subscriberid unascertainable'); case 126: return('sending TAN SMS failed'); case 150: return('subscriptionid unknown'); case 151: return('subscriptionid not unique'); case 152: return('subscription terminated'); case 200: return('internal server error'); case 999: return('hash cant be verified'); case 201: return('system currently unavailable'); default: return(900); } } } $bar = new mbe4('cms.testing', 'cmsTesting', '1002', '3002', 'https://cms.testing/api/payment/start'); $retval = $bar->create_transaction('909', 'product info comes here', '3.0', '1', 'https://cms.testing/daypass/activate' ,TRUE); echo $retval;

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.3.40.0120.00318.92
8.3.30.0100.00719.35
8.3.20.0000.00820.11
8.3.10.0050.00322.02
8.3.00.0080.00022.49
8.2.170.0030.01522.96
8.2.160.0080.00819.19
8.2.150.0030.00524.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0080.00319.61
8.2.110.0000.00922.20
8.2.100.0110.00019.39
8.2.90.0040.00419.34
8.2.80.0000.00819.38
8.2.70.0030.00717.75
8.2.60.0000.00818.16
8.2.50.0050.00318.07
8.2.40.0040.00418.38
8.2.30.0040.00418.12
8.2.20.0000.00717.96
8.2.10.0080.00018.05
8.2.00.0000.00917.99
8.1.270.0060.00318.75
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0030.00623.84
8.1.230.0070.00419.16
8.1.220.0040.00417.78
8.1.210.0050.00318.77
8.1.200.0060.00317.48
8.1.190.0030.00617.65
8.1.180.0000.00818.92
8.1.170.0030.00518.59
8.1.160.0060.00322.22
8.1.150.0000.00818.86
8.1.140.0040.00417.61
8.1.130.0000.00817.93
8.1.120.0000.00717.69
8.1.110.0000.00817.62
8.1.100.0040.00417.64
8.1.90.0050.00317.65
8.1.80.0050.00217.53
8.1.70.0070.00017.53
8.1.60.0000.00917.73
8.1.50.0000.00817.59
8.1.40.0040.00417.52
8.1.30.0000.00817.71
8.1.20.0060.00317.63
8.1.10.0000.00817.70
8.1.00.0000.01117.57
8.0.300.0050.00218.77
8.0.290.0000.00817.18
8.0.280.0000.00718.59
8.0.270.0040.00417.46
8.0.260.0000.00817.00
8.0.250.0000.00717.24
8.0.240.0040.00417.23
8.0.230.0030.00317.09
8.0.220.0050.00317.14
8.0.210.0000.00717.14
8.0.200.0030.00317.11
8.0.190.0080.00017.15
8.0.180.0030.00517.13
8.0.170.0000.00717.06
8.0.160.0030.00616.91
8.0.150.0070.00017.03
8.0.140.0000.00717.02
8.0.130.0030.00313.44
8.0.120.0000.00816.93
8.0.110.0000.00717.10
8.0.100.0050.00216.98
8.0.90.0040.00417.13
8.0.80.0120.00317.06
8.0.70.0040.00417.13
8.0.60.0040.00417.02
8.0.50.0050.00316.93
8.0.30.0120.00917.33
8.0.20.0140.00517.40
8.0.10.0080.00017.16
8.0.00.0080.01716.90
7.4.330.0050.00015.00
7.4.320.0030.00316.63
7.4.300.0070.00016.60
7.4.290.0100.00016.73
7.4.280.0000.00716.50
7.4.270.0000.00716.62
7.4.260.0000.00716.62
7.4.250.0040.00416.65
7.4.240.0040.00416.60
7.4.230.0070.00016.46
7.4.220.0160.00316.65
7.4.210.0120.00516.73
7.4.200.0050.00216.70
7.4.190.0030.00316.50
7.4.160.0120.01216.64
7.4.150.0080.01517.40
7.4.140.0120.00617.86
7.4.130.0160.00516.64
7.4.120.0070.01016.77
7.4.110.0110.00716.41
7.4.100.0150.01216.67
7.4.90.0150.00316.84
7.4.80.0070.01719.39
7.4.70.0060.01016.55
7.4.60.0100.00616.57
7.4.50.0020.00216.41
7.4.40.0060.00922.77
7.4.30.0060.01016.66
7.4.00.0000.01615.10
7.3.330.0000.00513.27
7.3.320.0060.00013.51
7.3.310.0070.00016.61
7.3.300.0040.00416.40
7.3.290.0090.00616.60
7.3.280.0070.01116.51
7.3.270.0120.00917.40
7.3.260.0100.00716.63
7.3.250.0110.00616.67
7.3.240.0090.00616.84
7.3.230.0130.01016.72
7.3.210.0070.01016.48
7.3.200.0110.00719.39
7.3.190.0070.01016.84
7.3.180.0070.01316.59
7.3.170.0090.01216.63
7.3.160.0060.00916.55
7.3.120.0070.01115.13
7.2.330.0120.00916.98
7.2.320.0060.01616.90
7.2.310.0100.00716.80
7.2.300.0090.00916.96
7.2.290.0130.00316.95
7.2.110.0260.01116.79
7.2.00.0060.00619.52
7.1.200.0000.00816.01
7.1.100.0000.00918.32
7.1.70.0000.00717.32
7.1.60.0130.01019.82
7.1.50.0070.00317.17
7.1.00.0030.06322.35
7.0.200.0080.00316.98
7.0.140.0000.07722.01
7.0.80.0730.07019.91
7.0.70.0500.04319.89
7.0.60.0400.05020.13
7.0.50.0470.08020.40
7.0.40.0270.05720.00
7.0.30.0200.07720.08
7.0.20.0170.08020.02
7.0.10.0000.09020.12
7.0.00.0100.08020.17
5.6.280.0030.07321.05
5.6.230.0030.05020.70
5.6.220.0070.04720.64
5.6.210.0070.05720.63
5.6.200.0130.05020.98
5.6.190.0100.08021.13
5.6.180.0100.07721.16
5.6.170.0070.09020.96
5.6.160.0070.08320.98
5.6.150.0030.06721.16
5.6.140.0000.06021.16
5.6.130.0030.05721.19
5.6.120.0070.08321.13
5.6.110.0100.07321.03
5.6.100.0200.08321.05
5.6.90.0170.08021.17
5.6.80.0100.08020.34
5.6.70.0030.08720.48
5.6.60.0170.06020.45
5.6.50.0100.05020.39
5.6.40.0130.07020.43
5.6.30.0070.07720.36
5.6.20.0130.07020.49
5.6.10.0100.07720.55
5.6.00.0030.07320.41
5.5.370.0100.08020.39
5.5.360.0000.07320.43
5.5.350.0000.04720.49
5.5.340.0070.08020.92
5.5.330.0030.08020.93
5.5.320.0100.06320.86
5.5.310.0070.05020.86
5.5.300.0070.08020.94
5.5.290.0130.08020.89
5.5.280.0070.07720.86
5.5.270.0070.06720.77
5.5.260.0130.08320.93
5.5.250.0100.05720.71
5.5.240.0070.07720.31
5.5.230.0100.06020.27
5.5.220.0130.06720.20
5.5.210.0070.04320.32
5.5.200.0030.07320.18
5.5.190.0100.06320.15
5.5.180.0200.07320.28
5.5.160.0130.04320.25
5.5.150.0070.06720.00
5.5.140.0100.07720.02
5.5.130.0000.08320.28
5.5.120.0070.06720.00
5.5.110.0130.06020.25
5.5.100.0070.08320.20
5.5.90.0070.08320.00
5.5.80.0070.07020.18
5.5.70.0100.04720.14
5.5.60.0170.07320.16
5.5.50.0030.06020.12
5.5.40.0030.04720.05
5.5.30.0170.04320.10
5.5.20.0070.07020.03
5.5.10.0100.07320.08
5.5.00.0100.05320.13
5.4.450.0130.07719.49
5.4.440.0100.04719.41
5.4.430.0200.07019.46
5.4.420.0070.07719.45
5.4.410.0100.07019.25
5.4.400.0070.07319.04
5.4.390.0130.07319.13
5.4.380.0100.05319.12
5.4.370.0070.06319.03
5.4.360.0030.08019.04
5.4.350.0200.04319.04
5.4.340.0030.08318.89
5.4.320.0070.07019.16
5.4.310.0030.05019.03
5.4.300.0030.04019.18
5.4.290.0070.07718.87
5.4.280.0100.07319.18
5.4.270.0070.05018.94
5.4.260.0030.06719.03
5.4.250.0030.07719.07
5.4.240.0130.07019.03
5.4.230.0070.07719.18
5.4.220.0100.05319.04
5.4.210.0070.06719.18
5.4.200.0100.07019.20
5.4.190.0070.04018.86
5.4.180.0130.06719.04
5.4.170.0070.07319.02
5.4.160.0030.07319.06
5.4.150.0100.07018.82
5.4.140.0100.06016.47
5.4.130.0170.06316.24
5.4.120.0030.04016.49
5.4.110.0100.06016.49
5.4.100.0070.05016.42
5.4.90.0070.07316.56
5.4.80.0030.07316.47
5.4.70.0070.07016.42
5.4.60.0070.07316.32
5.4.50.0100.06716.49
5.4.40.0000.07016.41
5.4.30.0100.03716.36
5.4.20.0100.07016.47
5.4.10.0030.07016.49
5.4.00.0070.06715.88
5.3.290.0030.04314.76
5.3.280.0130.07314.58
5.3.270.0070.07314.62
5.3.260.0000.07314.70
5.3.250.0000.08014.56
5.3.240.0030.06314.63
5.3.230.0070.06314.59
5.3.220.0130.06014.74
5.3.210.0030.06014.55
5.3.200.0070.06014.71
5.3.190.0070.06014.61
5.3.180.0130.04014.57
5.3.170.0070.08014.56
5.3.160.0070.06314.65
5.3.150.0100.07014.59
5.3.140.0100.07714.64
5.3.130.0100.07314.61
5.3.120.0170.06314.64
5.3.110.0100.07014.58
5.3.100.0000.05014.10
5.3.90.0070.06714.17
5.3.80.0070.04013.98
5.3.70.0070.07714.04
5.3.60.0130.06314.13
5.3.50.0070.07713.97
5.3.40.0130.03313.90
5.3.30.0000.07714.08
5.3.20.0170.06713.75
5.3.10.0070.07013.61
5.3.00.0000.07713.66
5.2.170.0070.04311.30
5.2.160.0030.05011.28
5.2.150.0100.05311.24
5.2.140.0100.05711.18
5.2.130.0130.05011.13
5.2.120.0030.05311.20
5.2.110.0070.04311.25
5.2.100.0200.05011.16
5.2.90.0070.06011.00
5.2.80.0070.06011.20
5.2.70.0070.06311.05
5.2.60.0070.04011.21
5.2.50.0030.06311.09
5.2.40.0070.06311.05
5.2.30.0100.03010.90
5.2.20.0070.04711.14
5.2.10.0000.05010.96
5.2.00.0070.03710.89
5.1.60.0000.02710.89
5.1.50.0030.06010.89
5.1.40.0070.04310.89
5.1.30.0070.03310.89
5.1.20.0070.02710.89
5.1.10.0070.05710.89
5.1.00.0100.05010.89
5.0.50.0000.03710.89
5.0.40.0000.02710.89
5.0.30.0070.06310.89
5.0.20.0000.04310.89
5.0.10.0000.04010.89
5.0.00.0100.06010.89
4.4.90.0000.03710.89
4.4.80.0030.03310.89
4.4.70.0030.03710.89
4.4.60.0030.03310.89
4.4.50.0070.02310.89
4.4.40.0000.02710.89
4.4.30.0070.03010.89
4.4.20.0030.02010.89
4.4.10.0070.03310.89
4.4.00.0030.04010.89
4.3.110.0000.04010.89
4.3.100.0070.02710.89
4.3.90.0000.03310.89
4.3.80.0000.04310.89
4.3.70.0030.03010.89
4.3.60.0030.03710.89
4.3.50.0030.03010.89
4.3.40.0030.03310.89
4.3.30.0030.02010.89
4.3.20.0000.03710.89
4.3.10.0000.03710.89
4.3.00.0000.03010.89

preferences:
40.79 ms | 400 KiB | 5 Q