3v4l.org

run code in 300+ PHP versions simultaneously
<?php mysql_connect('hote','utilisateur','mot_de_passe'); mysql_select_db('base_de_donnee'); //On determine l'expression a rechercher if(isset($_GET['recherche'])) { $rec = htmlentities($_GET['recherche']); } else { $rec = 'php MYSQL'; } //On determine le type de recherche if(isset($_GET['type'])) { if($_GET['type']=='un')//Un des mots { $type = 1; } elseif($_GET['type']=='tout')//Tout les mots { $type = 2; } else//L'expression exacte { $type = 3; } } else { $type = 1;//type par defaut: L'expression exacte } //On determine si on doit surligner les mots dans les resultats if(!isset($_GET['surligner']) or $_GET['surligner']!='true') { $surligner = false; } else { $surligner = true; } //On dertermine les identifiants, les noms et les informations des utilisateur $req = 'SELECT id, nom, infos FROM utilisateurs WHERE '; if($type==1) {//ayant un des mots dans leurs informations $mots = explode(' ',$rec);//En separre lexpression en mots cles foreach($mots as $mot) { $req .= ' infos LIKE "%'.$mot.'%" OR'; } $req .= ' 1=0'; } elseif($type==2) {//ayant tout des mots dans leurs informations $mots = explode(' ',$rec);//En separre lexpression en mots cles foreach($mots as $mot) { $req .= ' infos LIKE "%'.$mot.'%" AND'; } $req .= ' 1=1'; } else {//ayant l'expression exacte dans leurs informations $req .= 'infos LIKE "%'.$rec.'%"'; } //Les utilisateur seront ranges par identifiant en ordre croissant $req .= ' order by id asc'; $requete = mysql_query($req); //Le formulaire de recherche ?> <form action="" method="get"> Expression &agrave; rechercher: <input type="text" name="recherche" value="<?php echo $rec; ?>" /><br /> Type de recherche: <input type="radio" name="type" value="un"<?php if($type==1){echo 'checked="checked"';} ?> /> Un des mots <input type="radio" name="type" value="tout"<?php if($type==2){echo 'checked="checked"';} ?> /> Tout les mots <input type="radio" name="type" value="exacte"<?php if($type==3){echo 'checked="checked"';} ?> /> Expression exacte<br /> Mettre en gras les mots recherch&eacute;s: <input type="checkbox" name="surligner" value="true" <?php if($surligner){echo 'checked="checked"';} ?> /><br /> <input type="submit" value="Rechercher" /> </form> <h2>R&eacute;sultats</h2> <table> <tr> <th>Identifiant</th> <th>Nom</th> <th>Informations</th> </tr> <?php //On affiche les resultats while($dnn = mysql_fetch_array($requete)) { ?> <tr> <td><?php echo $dnn['id']; ?></td> <td><?php echo $dnn['nom']; ?></td> <td><?php if($surligner)//Si il faut surligner les mots, on les surligne { if($type==3) { echo preg_replace('#('.preg_quote($rec).')#i', '<strong>$1</strong>', $dnn['infos']);//On surligne l'expression exacte } else { echo preg_replace('#('.str_replace(' ','|',preg_quote($rec)).')#i', '<strong>$1</strong>', $dnn['infos']);//On surligne les mots cles de la recherche } } else { echo $dnn['infos'];//On ne surligne pas } ?></td> </tr> <?php } ?> </table>

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.60.0110.01116.48
8.3.50.0110.00718.32
8.3.40.0120.00318.66
8.3.30.0070.00718.89
8.3.20.0130.00720.12
8.3.10.0090.00023.50
8.3.00.0000.00819.97
8.2.180.0130.00918.32
8.2.170.0090.00622.96
8.2.160.0080.00820.35
8.2.150.0120.00325.66
8.2.140.0070.00024.66
8.2.130.0080.00019.33
8.2.120.0040.00426.35
8.2.110.0090.00022.11
8.2.100.0120.00018.04
8.2.90.0040.00419.26
8.2.80.0040.00417.97
8.2.70.0000.00917.50
8.2.60.0080.00017.92
8.2.50.0000.00818.07
8.2.40.0000.00822.39
8.2.30.0030.00520.61
8.2.20.0070.00017.61
8.2.10.0000.00817.98
8.2.00.0030.00517.92
8.1.280.0130.00725.92
8.1.270.0050.00320.32
8.1.260.0050.00228.09
8.1.250.0070.00028.09
8.1.240.0070.01023.84
8.1.230.0080.00417.70
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0060.00317.25
8.1.190.0030.00517.00
8.1.180.0050.00318.10
8.1.170.0040.00418.59
8.1.160.0000.00820.69
8.1.150.0040.00418.86
8.1.140.0040.00419.49
8.1.130.0070.00017.58
8.1.120.0000.00717.37
8.1.110.0050.00317.40
8.1.100.0050.00217.28
8.1.90.0050.00317.34
8.1.80.0040.00417.28
8.1.70.0030.00317.27
8.1.60.0050.00317.54
8.1.50.0040.00417.56
8.1.40.0000.00817.50
8.1.30.0080.00017.65
8.1.20.0000.00717.61
8.1.10.0040.00417.61
8.1.00.0030.00617.49
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0000.00718.37
8.0.270.0000.00817.16
8.0.260.0030.00317.30
8.0.250.0000.00717.01
8.0.240.0000.00816.90
8.0.230.0030.00317.00
8.0.220.0070.00016.95
8.0.210.0000.00816.89
8.0.200.0000.00616.99
8.0.190.0080.00017.02
8.0.180.0000.00816.98
8.0.170.0000.00716.98
8.0.160.0000.00916.86
8.0.150.0000.00916.91
8.0.140.0050.00316.86
8.0.130.0030.00313.38
8.0.120.0000.00816.79
8.0.110.0000.00716.86
8.0.100.0080.00016.79
8.0.90.0040.00417.00
8.0.80.0060.00916.93
8.0.70.0040.00416.77
8.0.60.0040.00416.88
8.0.50.0000.00716.86
8.0.30.0060.01217.12
8.0.20.0070.01217.40
8.0.10.0070.00017.04
8.0.00.0090.00816.92
7.4.330.0000.00516.89
7.4.320.0030.00316.42
7.4.300.0030.00316.63
7.4.290.0080.00016.58
7.4.280.0030.00316.58
7.4.270.0040.00416.52
7.4.260.0000.00816.40
7.4.250.0040.00416.39
7.4.240.0040.00416.57
7.4.230.0080.00016.63
7.4.220.0090.00916.59
7.4.210.0070.00716.55
7.4.200.0030.00316.40
7.4.160.0100.00616.50
7.4.150.0090.00917.40
7.4.140.0110.01117.86
7.4.130.0110.00916.54
7.4.120.0140.00616.64
7.4.110.0090.00916.54
7.4.100.0120.00416.28
7.4.90.0030.01316.57
7.4.80.0110.01119.39
7.4.70.0110.00516.47
7.4.60.0070.01116.30
7.4.50.0040.00816.54
7.4.40.0120.00316.32
7.4.30.0070.01016.60
7.4.00.0090.00614.86
7.3.330.0000.00613.06
7.3.320.0030.00313.12
7.3.310.0080.00016.21
7.3.300.0030.00316.20
7.3.290.0070.00016.36
7.3.280.0120.00516.33
7.3.270.0100.01317.40
7.3.260.0090.00916.27
7.3.250.0110.00916.28
7.3.240.0130.00816.56
7.3.230.0100.01016.55
7.3.210.0060.01016.31
7.3.200.0060.00916.50
7.3.190.0060.00916.34
7.3.180.0120.00916.29
7.3.170.0120.00916.27
7.3.160.0030.01216.43
7.3.120.0000.01615.00
7.3.110.0030.01214.82
7.3.100.0040.01114.87
7.3.90.0000.01415.03
7.3.80.0130.00014.71
7.3.70.0080.00414.84
7.3.60.0060.00614.82
7.3.50.0000.01514.97
7.3.40.0030.01214.79
7.3.30.0120.00014.88
7.3.20.0030.00616.50
7.3.10.0060.00616.55
7.3.00.0040.00616.49
7.2.330.0110.00716.49
7.2.320.0100.00616.63
7.2.310.0120.00616.58
7.2.300.0140.00416.45
7.2.290.0110.00816.50
7.2.250.0070.01014.74
7.2.240.0120.00614.77
7.2.230.0070.00714.88
7.2.220.0040.01415.23
7.2.210.0040.01515.17
7.2.200.0030.01314.92
7.2.190.0070.01014.90
7.2.180.0030.00715.04
7.2.170.0040.01115.00
7.2.130.0000.01516.80
7.2.120.0070.00716.65
7.2.110.0000.01216.78
7.2.100.0080.00816.60
7.2.90.0040.01116.84
7.2.80.0040.00816.90
7.2.70.0070.00716.63
7.2.60.0070.00716.78
7.2.50.0090.00316.83
7.2.40.0100.00316.88
7.2.30.0050.00516.89
7.2.20.0040.00816.76
7.2.10.0090.00016.85
7.2.00.0060.00517.88
7.1.330.0080.00415.39
7.1.320.0060.00615.57
7.1.310.0040.00715.63
7.1.300.0040.00715.70
7.1.290.0040.01115.72
7.1.280.0000.00915.65
7.1.270.0030.00715.62
7.1.260.0100.00715.46
7.1.250.0050.00515.36
7.1.200.0030.00615.50
7.1.100.0060.00618.01
7.1.70.0000.00716.96
7.1.60.0120.01219.52
7.1.50.0130.00716.89
7.1.00.0030.07722.31
7.0.200.0120.00016.46
7.0.60.0070.06719.96
7.0.50.0030.04017.96
7.0.40.0100.05720.02
7.0.30.0330.04320.01
7.0.20.0270.08020.00
7.0.10.0100.07320.04
7.0.00.0030.04720.09
5.6.280.0000.03320.79
5.6.210.0000.04320.62
5.6.200.0130.08018.16
5.6.190.0030.08720.60
5.6.180.0300.07020.56
5.6.170.0300.08020.54
5.6.160.0030.06720.70
5.6.150.0130.06018.12
5.6.140.0000.08018.21
5.6.130.0000.07718.17
5.6.120.0030.05720.99
5.6.110.0070.08021.07
5.6.100.0030.08021.15
5.6.90.0130.07020.99
5.6.80.0000.05020.43
5.5.350.0130.03320.43
5.5.340.0070.03717.88
5.5.330.0070.03720.38
5.5.320.0330.04320.51
5.5.310.0230.06320.24
5.5.300.0070.06717.98
5.5.290.0170.07317.95
5.5.280.0130.08720.69
5.5.270.0070.08320.77
5.5.260.0070.08320.95
5.5.250.0000.06020.57
5.5.240.0230.08020.02

preferences:
89.34 ms | 400 KiB | 5 Q