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 ', ' o ', ' 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.2 - 7.1.0
Could not find anything related ====================== Albert s Einstein was born Ulm Kingdom Württemberg German Empire 14 March 1879 [10] father was Hermann Einstein salesman engineer mother was Pauline Einstein née Koch 1880 family moved Munich where father uncle founded Elektrotechnische Fabrik J Einstein Cie company that manufactured electrical equipment based direct current [10] The Einsteins were non observant Ashkenazi Jews Albert s attended Catholic elementary school from age five three years At age eight was transferred Luitpold Gymnasium now known as Albert s Einstein Gymnasium where received advanced primary secondary school education until left Germany seven years later [11] Contrary popular suggestions that had struggled with early speech difficulties Albert s Einstein Archives indicate excelled at first school that attended [12] was right handed;[12][13] there appears be evidence widespread popular belief[14] that was left handed His father once showed him pocket compass; Einstein realized that there must be something causing needle move despite apparent empty space [15] As grew Einstein built models mechanical devices fun began show talent mathematics [10] When Einstein was ten years old Max Talmud later changed Max Talmey poor Jewish medical student from Poland was introduced Einstein family brother During weekly visits over next five years gave boy popular books science mathematical texts philosophical writings These included Immanuel Kant s Critique Pure Reason Euclid s Elements which Einstein called holy little geometry book [16][17][fn 1] In 1894 father s company failed: direct current DC lost War Currents alternating current AC search business Einstein family moved Italy first Milan then few months later Pavia When family moved Pavia Einstein stayed Munich finish studies at Luitpold Gymnasium father intended him pursue electrical engineering Einstein clashed with authorities resented school s regimen teaching method later wrote that spirit learning creative thought were lost strict rote learning At end December 1894 travelled Italy join family Pavia convincing school let him go using doctor s note [19] It was during time Italy that wrote short essay with title Investigation State Ether Magnetic Field [20][21] In 1895 at age sixteen Einstein sat entrance examinations Swiss Federal Polytechnic Zürich later Eidgenössische Technische Hochschule ETH failed reach required standard general part examination [22] obtained exceptional grades physics mathematics [23] advice Principal Polytechnic attended Argovian cantonal school gymnasium Aarau Switzerland 1895–96 complete secondary schooling While lodging with family Professor Jost Winteler fell love with Winteler s daughter Marie Albert s sister Maja later married Wintelers son Paul [24] January 1896 with father s approval renounced citizenship German Kingdom Württemberg avoid military service [25] September 1896 passed Swiss Matura with mostly good grades including top grade 6 physics mathematical subjects scale 1 6 [26] though only seventeen enrolled four year mathematics physics teaching diploma program at Zürich Polytechnic Marie Winteler moved Olsberg Switzerland teaching post Einstein s future wife Mileva Marić also enrolled at Polytechnic that same year only woman among six students mathematics physics section teaching diploma course Over next few years Einstein Marić s friendship developed into romance they read books together extra curricular physics which Einstein was taking an increasing interest 1900 Einstein was awarded Zürich Polytechnic teaching diploma Marić failed examination with poor grade mathematics component theory functions [27] There have been claims that Marić collaborated with Einstein celebrated 1905 papers [28][29] historians physics who have studied issue find evidence that made any substantive contributions xdva s uter
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/9dIOW on line 75 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/9dIOW on line 75 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/9dIOW on line 75 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/9dIOW on line 75 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/9dIOW on line 75 PHP_EOLPHP_EOL======================PHP_EOLPHP_EOLPHP_EOLAlbert s Einstein was born Ulm Kingdom Württemberg German Empire 14 March 1879 [10] father was Hermann Einstein salesman engineer mother was Pauline Einstein née Koch 1880 family moved Munich where father uncle founded Elektrotechnische Fabrik J Einstein Cie company that manufactured electrical equipment based direct current [10] The Einsteins were non observant Ashkenazi Jews Albert s attended Catholic elementary school from age five three years At age eight was transferred Luitpold Gymnasium now known as Albert s Einstein Gymnasium where received advanced primary secondary school education until left Germany seven years later [11] Contrary popular suggestions that had struggled with early speech difficulties Albert s Einstein Archives indicate excelled at first school that attended [12] was right handed;[12][13] there appears be evidence widespread popular belief[14] that was left handed His father once showed him pocket compass; Einstein realized that there must be something causing needle move despite apparent empty space [15] As grew Einstein built models mechanical devices fun began show talent mathematics [10] When Einstein was ten years old Max Talmud later changed Max Talmey poor Jewish medical student from Poland was introduced Einstein family brother During weekly visits over next five years gave boy popular books science mathematical texts philosophical writings These included Immanuel Kant s Critique Pure Reason Euclid s Elements which Einstein called holy little geometry book [16][17][fn 1] In 1894 father s company failed: direct current DC lost War Currents alternating current AC search business Einstein family moved Italy first Milan then few months later Pavia When family moved Pavia Einstein stayed Munich finish studies at Luitpold Gymnasium father intended him pursue electrical engineering Einstein clashed with authorities resented school s regimen teaching method later wrote that spirit learning creative thought were lost strict rote learning At end December 1894 travelled Italy join family Pavia convincing school let him go using doctor s note [19] It was during time Italy that wrote short essay with title Investigation State Ether Magnetic Field [20][21] In 1895 at age sixteen Einstein sat entrance examinations Swiss Federal Polytechnic Zürich later Eidgenössische Technische Hochschule ETH failed reach required standard general part examination [22] obtained exceptional grades physics mathematics [23] advice Principal Polytechnic attended Argovian cantonal school gymnasium Aarau Switzerland 1895–96 complete secondary schooling While lodging with family Professor Jost Winteler fell love with Winteler s daughter Marie Albert s sister Maja later married Wintelers son Paul [24] January 1896 with father s approval renounced citizenship German Kingdom Württemberg avoid military service [25] September 1896 passed Swiss Matura with mostly good grades including top grade 6 physics mathematical subjects scale 1 6 [26] though only seventeen enrolled four year mathematics physics teaching diploma program at Zürich Polytechnic Marie Winteler moved Olsberg Switzerland teaching post Einstein s future wife Mileva Marić also enrolled at Polytechnic that same year only woman among six students mathematics physics section teaching diploma course Over next few years Einstein Marić s friendship developed into romance they read books together extra curricular physics which Einstein was taking an increasing interest 1900 Einstein was awarded Zürich Polytechnic teaching diploma Marić failed examination with poor grade mathematics component theory functions [27] There have been claims that Marić collaborated with Einstein celebrated 1905 papers [28][29] historians physics who have studied issue find evidence that made any substantive contributions xdva s uter
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: str_ireplace() in /in/9dIOW on line 44
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: str_ireplace() in /in/9dIOW on line 44
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: str_ireplace() in /in/9dIOW on line 44