3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function search_text($full_text, $words, $offset=0) { $words_found = 0; $stripped_text = remove_irrelevant_text($full_text); if(!is_array($words)) { $words = explode(' ', $words); } $total_words = sizeof($words); foreach($words as $word) { if(stripos($stripped_text, $word, $offset)) { $words_found++; } } $relative = ($words_found / $total_words) * 100; $result = array( 'total_words'=>$total_words, 'percentage_found'=>number_format($relative, 0), 'parsed_text'=>$stripped_text ); return $result; } function remove_irrelevant_text($text) { $remove = array( '?','!', ',', '\'', '"', '#', '$', '&', '*', '(', ')', '-', '+', '.', 'for', 'to', 'in', 'the', 'and', 'on', 'of', 'by', 'he', 'she', 'his', 'her', 'a', 'but', 'para', 'no', 'na', 'e', 'em', 'do', 'de', 'da', 'por', 'ele', 'ela', 'seu', 'dela', 'é', 'mas' ); return str_ireplace($remove, '', $text); } $str = <<<EOT Albert's Einstein was born in Ulm, in the Kingdom of Württemberg in the German Empire on 14 March 1879.[10] His father was Hermann Einstein, a salesman and engineer. His mother was Pauline Einstein (née Koch). In 1880, the family moved to Munich, where his father and his uncle founded Elektrotechnische Fabrik J. Einstein & Cie, a company that manufactured electrical equipment based on direct current.[10] The Einsteins were non-observant Ashkenazi Jews. Albert's attended a Catholic elementary school from the age of five for three years. At the age of eight, he was transferred to the Luitpold Gymnasium (now known as the Albert's Einstein Gymnasium), where he received advanced primary and secondary school education until he left Germany seven years later.[11] Contrary to popular suggestions that he had struggled with early speech difficulties, the Albert's Einstein Archives indicate he excelled at the first school that he attended.[12] He was right-handed;[12][13] there appears to be no evidence for the widespread popular belief[14] that he was left-handed. His father once showed him a pocket compass; Einstein realized that there must be something causing the needle to move, despite the apparent "empty space".[15] As he grew, Einstein built models and mechanical devices for fun and began to show a talent for mathematics.[10] When Einstein was ten years old, Max Talmud (later changed to Max Talmey), a poor Jewish medical student from Poland, was introduced to the Einstein family by his brother. During weekly visits over the next five years, he gave the boy popular books on science, mathematical texts and philosophical writings. These included Immanuel Kant's Critique of Pure Reason, and Euclid's Elements (which Einstein called the "holy little geometry book").[16][17][fn 1] In 1894, his father's company failed: direct current (DC) lost the War of Currents to alternating current (AC). In search of business, the Einstein family moved to Italy, first to Milan and then, a few months later, to Pavia. When the family moved to Pavia, Einstein stayed in Munich to finish his studies at the Luitpold Gymnasium. His father intended for him to pursue electrical engineering, but Einstein clashed with authorities and resented the school's regimen and teaching method. He later wrote that the spirit of learning and creative thought were lost in strict rote learning. At the end of December 1894, he travelled to Italy to join his family in Pavia, convincing the school to let him go by using a doctor's note.[19] It was during his time in Italy that he wrote a short essay with the title "On the Investigation of the State of the Ether in a Magnetic Field."[20][21] In 1895, at the age of sixteen, Einstein sat the entrance examinations for the Swiss Federal Polytechnic in Zürich (later the Eidgenössische Technische Hochschule ETH). He failed to reach the required standard in the general part of the examination,[22] but obtained exceptional grades in physics and mathematics.[23] On the advice of the Principal of the Polytechnic, he attended the Argovian cantonal school (gymnasium) in Aarau, Switzerland, in 1895–96 to complete his secondary schooling. While lodging with the family of Professor Jost Winteler, he fell in love with Winteler's daughter, Marie. (Albert's sister Maja later married Wintelers' son Paul.)[24] In January 1896, with his father's approval, he renounced his citizenship in the German Kingdom of Württemberg to avoid military service.[25] In September 1896, he passed the Swiss Matura with mostly good grades, including a top grade of 6 in physics and mathematical subjects, on a scale of 1-6,[26] and, though only seventeen, enrolled in the four-year mathematics and physics teaching diploma program at the Zürich Polytechnic. Marie Winteler moved to Olsberg, Switzerland for a teaching post. Einstein's future wife, Mileva Marić, also enrolled at the Polytechnic that same year, the only woman among the six students in the mathematics and physics section of the teaching diploma course. Over the next few years, Einstein and Marić's friendship developed into romance, and they read books together on extra-curricular physics in which Einstein was taking an increasing interest. In 1900, Einstein was awarded the Zürich Polytechnic teaching diploma, but Marić failed the examination with a poor grade in the mathematics component, theory of functions.[27] There have been claims that Marić collaborated with Einstein on his celebrated 1905 papers,[28][29] but historians of physics who have studied the issue find no evidence that she made any substantive contributions xdva's uter. EOT; $search = "where did Einstein's wife was born?"; $result = search_text($str, $search); if($result['percentage_found'] > 50) { echo $result['percentage_found']. '% related to your query (Total words: '.$result['total_words'].', Words found: '.$result['percentage_found'].')'; } else { echo 'Could not find anything related'; } echo PHP_EOL.PHP_EOL.'======================'.PHP_EOL.PHP_EOL.PHP_EOL.$result['parsed_text'];
Output for 5.0.5 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Could not find anything related ====================== lbrts st ws born Ulm Kgm Württmbrg Grmn mpir 14 Mrch 1879[10] fr ws rmnn st slsmn ngr mor ws Pul st n Koch 1880 fmily movd Munich wr fr uncl foundd lktrotchnisc Fbrik J st Ci compny tht mnufcturd lctricl quipmnt bsd dirct currnt[10] sts wr bsrvnt shknzi Jws lbrts ttndd Ctholic lmntry school from g fiv thr yrs t g ight ws trnsfrrd Luitpold Gymnsium w kwn s lbrts st Gymnsium wr rcivd dvncd primry scdry school ducti until lft Grmny svn yrs ltr[11] Ctrry populr suggstis tht hd struggld with rly spch difficultis lbrts st rchivs dict xclld t first school tht ttndd[12] ws rightd;[12][13] r pprs b vidnc widsprd populr blif[14] tht ws lftd fr c showd him pockt compss; st rlizd tht r must b somthg cusg ndl mov dspit pprnt mpty spc[15] s grw st built modls mchnicl dvics fun bgn show tlnt mmtics[10] Wn st ws tn yrs old Mx Tlmud ltr chngd Mx Tlmy poor Jwish mdicl studnt from Pol ws troducd st fmily bror Durg wkly visits ovr nxt fiv yrs gv boy populr books scinc mmticl txts philosophicl writgs s cludd Immnul Knts Critiqu Pur Rs uclids lmnts which st clld holy littl gomtry book[16][17][fn 1] 1894 frs compny fild: dirct currnt DC lost Wr Currnts ltrntg currnt C srch busss st fmily movd Itly first Miln n fw mths ltr Pvi Wn fmily movd Pvi st styd Munich fish studis t Luitpold Gymnsium fr tndd him pursu lctricl ngrg st clsd with uthoritis rsntd schools rgimn tchg mthod ltr wrot tht spirit lrng crtiv thought wr lost strict rot lrng t nd Dcmbr 1894 trvlld Itly jo fmily Pvi cvcg school lt him go usg crs t[19] It ws durg tim Itly tht wrot short ssy with titl vstigti Stt r Mgntic Fild[20][21] 1895 t g sixtn st st ntrnc xmtis Swiss Fdrl Polytchnic Zürich ltr idgnössisc Tchnisc Hochschul TH fild rch rquird strd gnrl prt xmti[22] obtd xcptil grds physics mmtics[23] dvic Prcipl Polytchnic ttndd rgovin cnnl school gymnsium ru Switzrl 1895–96 complt scdry schoolg Whil lodgg with fmily Prssor Jost Wtlr fll lov with Wtlrs dughtr Mri lbrts sistr Mj ltr mrrid Wtlrs s Pul[24] Jnury 1896 with frs pprovl runcd citiznship Grmn Kgm Württmbrg void militry srvic[25] Sptmbr 1896 pssd Swiss Mtur with mostly good grds cludg p grd 6 physics mmticl subjcts scl 16[26] though ly svntn nrolld fouryr mmtics physics tchg diplom progrm t Zürich Polytchnic Mri Wtlr movd Olsbrg Switzrl tchg post sts futur wif Milv Mrić lso nrolld t Polytchnic tht sm yr ly womn mg six studnts mmtics physics scti tchg diplom cours Ovr nxt fw yrs st Mrićs frindship dvlopd romnc y rd books gr xtrcurriculr physics which st ws tkg n crsg trst 1900 st ws wrdd Zürich Polytchnic tchg diplom Mrić fild xmti with poor grd mmtics compnt ory functis[27] r hv bn clims tht Mrić collbortd with st clbrtd 1905 pprs[28][29] rins physics who hv studid issu fd vidnc tht s md ny substntiv ctriis xdvs utr
Output for 5.0.2 - 5.0.4
Could not find anything related ====================== lbrts st ws born Ulm Kgm Württmbrg Grmn mpir 14 Mrch 1879[10] fr ws rmnn st slsmn ngr mor ws Pul st n Koch 1880 fmily movd Munich wr fr uncl foundd lktrotchnisc Fbrik J st Ci compny tht mnufcturd lctricl quipmnt bsd dirct currnt[10] sts wr bsrvnt shknzi Jws lbrts ttndd Ctholic lmntry school from g fiv thr yrs t g ight ws trnsfrrd Luitpold Gymnsium w kwn s lbrts st Gymnsium wr rcivd dvncd primry scdry school ducti until lft Grmny svn yrs ltr[11] Ctrry populr suggstis tht hd struggld with rly spch difficultis lbrts st rchivs dict xclld t first school tht ttndd[12] ws rightd;[12][13] r pprs b vidnc widsprd populr blif[14] tht ws lftd fr c showd him pockt compss; st rlizd tht r must b somthg cusg ndl mov dspit pprnt mpty spc[15] s grw st built modls mchnicl dvics fun bgn show tlnt mmtics[10] Wn st ws tn yrs old Mx Tlmud ltr chngd Mx Tlmy poor Jwish mdicl studnt from Pol ws troducd st fmily bror Durg wkly visits ovr nxt fiv yrs gv boy populr books scinc mmticl txts philosophicl writgs s cludd Immnul Knts Critiqu Pur Rs uclids lmnts which st clld holy littl gomtry book[16][17][fn 1] 1894 frs compny fild: dirct currnt DC lost Wr Currnts ltrntg currnt C srch busss st fmily movd Itly first Miln n fw mths ltr Pvi Wn fmily movd Pvi st styd Munich fish studis t Luitpold Gymnsium fr tndd him pursu lctricl ngrg st clsd with uthoritis rsntd schools rgimn tchg mthod ltr wrot tht spirit lrng crtiv thought wr lost strict rot lrng t nd Dcmbr 1894 trvlld Itly jo fmily Pvi cvcg school lt him go usg crs t[19] It ws durg tim Itly tht wrot short ssy with titl vstigti Stt r Mgntic Fild[20][21] 1895 t g sixtn st st ntrnc xmtis Swiss Fdrl Polytchnic Zürich ltr idgnössisc Tchnisc Hochschul TH fild rch rquird strd gnrl prt xmti[22] obtd xcptil grds physics mmtics[23] dvic Prcipl Polytchnic ttndd rgovin cnnl school gymnsium ru Switzrl 1895–96 complt scdry schoolg Whil lodgg with fmily Prssor Jost Wtlr fll lov with Wtlrs dughtr Mri lbrts sistr Mj ltr mrrid Wtlrs s Pul[24] Jnury 1896 with frs pprovl runcd citiznship Grmn Kgm Württmbrg void militry srvic[25] Sptmbr 1896 pssd Swiss Mtur with mostly good grds cludg p grd 6 physics mmticl subjcts scl 16[26] though ly svntn nrolld fouryr mmtics physics tchg diplom progrm t Zürich Polytchnic Mri Wtlr movd Olsbrg Switzrl tchg post sts futur wif Milv Mrić lso nrolld t Polytchnic tht sm yr ly womn mg six studnts mmtics physics scti tchg diplom cours Ovr nxt fw yrs st Mrićs frindship dvlopd romnc y rd books gr xtrcurriculr physics which st ws tkg n crsg trst 1900 st ws wrdd Zürich Polytchnic tchg diplom Mrić fild xmti with poor grd mmtics compnt ory functis[27] r hv bn clims tht Mrić collbortd with st clbrtd 1905 pprs[28][29] rins physics who hv studid issu fd vidnc tht s md ny substntiv ctriis xdvs utr marić failooks ger extrcurriculr phy
Output for 5.0.0 - 5.0.1
Could not find anything related Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/8uVLb on line 74 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/8uVLb on line 74 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/8uVLb on line 74 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/8uVLb on line 74 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/8uVLb on line 74 PHP_EOLPHP_EOL======================PHP_EOLPHP_EOLPHP_EOLlbrts st ws born Ulm Kgm Württmbrg Grmn mpir 14 Mrch 1879[10] fr ws rmnn st slsmn ngr mor ws Pul st n Koch 1880 fmily movd Munich wr fr uncl foundd lktrotchnisc Fbrik J st Ci compny tht mnufcturd lctricl quipmnt bsd dirct currnt[10] sts wr bsrvnt shknzi Jws lbrts ttndd Ctholic lmntry school from g fiv thr yrs t g ight ws trnsfrrd Luitpold Gymnsium w kwn s lbrts st Gymnsium wr rcivd dvncd primry scdry school ducti until lft Grmny svn yrs ltr[11] Ctrry populr suggstis tht hd struggld with rly spch difficultis lbrts st rchivs dict xclld t first school tht ttndd[12] ws rightd;[12][13] r pprs b vidnc widsprd populr blif[14] tht ws lftd fr c showd him pockt compss; st rlizd tht r must b somthg cusg ndl mov dspit pprnt mpty spc[15] s grw st built modls mchnicl dvics fun bgn show tlnt mmtics[10] Wn st ws tn yrs old Mx Tlmud ltr chngd Mx Tlmy poor Jwish mdicl studnt from Pol ws troducd st fmily bror Durg wkly visits ovr nxt fiv yrs gv boy populr books scinc mmticl txts philosophicl writgs s cludd Immnul Knts Critiqu Pur Rs uclids lmnts which st clld holy littl gomtry book[16][17][fn 1] 1894 frs compny fild: dirct currnt DC lost Wr Currnts ltrntg currnt C srch busss st fmily movd Itly first Miln n fw mths ltr Pvi Wn fmily movd Pvi st styd Munich fish studis t Luitpold Gymnsium fr tndd him pursu lctricl ngrg st clsd with uthoritis rsntd schools rgimn tchg mthod ltr wrot tht spirit lrng crtiv thought wr lost strict rot lrng t nd Dcmbr 1894 trvlld Itly jo fmily Pvi cvcg school lt him go usg crs t[19] It ws durg tim Itly tht wrot short ssy with titl vstigti Stt r Mgntic Fild[20][21] 1895 t g sixtn st st ntrnc xmtis Swiss Fdrl Polytchnic Zürich ltr idgnössisc Tchnisc Hochschul TH fild rch rquird strd gnrl prt xmti[22] obtd xcptil grds physics mmtics[23] dvic Prcipl Polytchnic ttndd rgovin cnnl school gymnsium ru Switzrl 1895–96 complt scdry schoolg Whil lodgg with fmily Prssor Jost Wtlr fll lov with Wtlrs dughtr Mri lbrts sistr Mj ltr mrrid Wtlrs s Pul[24] Jnury 1896 with frs pprovl runcd citiznship Grmn Kgm Württmbrg void militry srvic[25] Sptmbr 1896 pssd Swiss Mtur with mostly good grds cludg p grd 6 physics mmticl subjcts scl 16[26] though ly svntn nrolld fouryr mmtics physics tchg diplom progrm t Zürich Polytchnic Mri Wtlr movd Olsbrg Switzrl tchg post sts futur wif Milv Mrić lso nrolld t Polytchnic tht sm yr ly womn mg six studnts mmtics physics scti tchg diplom cours Ovr nxt fw yrs st Mrićs frindship dvlopd romnc y rd books gr xtrcurriculr physics which st ws tkg n crsg trst 1900 st ws wrdd Zürich Polytchnic tchg diplom Mrić fild xmti with poor grd mmtics compnt ory functis[27] r hv bn clims tht Mrić collbortd with st clbrtd 1905 pprs[28][29] rins physics who hv studid issu fd vidnc tht s md ny substntiv ctriis xdvs utr marić failooks ger extrcurriculr phy
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: str_ireplace() in /in/8uVLb on line 43
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: str_ireplace() in /in/8uVLb on line 43
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: str_ireplace() in /in/8uVLb on line 43