3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $site_a['text'] = " wort 1 t&auml;glich wort 2"; preg_match('/<title>(.*?)<\/title>/is', $site_a['text'], $title); if(isset($title[1])) { $title = $title[1]; $title = preg_replace('/[^a-z0-9\.-üßäö]+/', ' ', $title); }else $title = ""; $site = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $site_a['text']); $site = preg_replace('#<style(.*?)>(.*?)</style>#is', '', $site); $site = preg_replace('#<a(.*?)>(.*?)</a>#is', '', $site); $site = preg_replace('#<title(.*?)>(.*?)</title>#is', '', $site); $site = strip_tags($site); $site = preg_replace('/[\?]+\s/', '. ', $site); $site = preg_replace('/[\!]+\s/', '. ', $site); $site = preg_replace('/\s\s+/', ' ', $site); $site = strtolower ( $site ); //$site = html_entity_decode($site, ENT_QUOTES, "UTF-8"); $site = html_entity_decode($site, ENT_QUOTES, "ISO-8859-1"); $site = preg_replace('/[^a-z0-9\.\?-üßäö\s]+/', ' ', $site); $search = array("[", "]", "{", "}", ":"); $text = str_replace($search, "", $site); $text = utf8_encode ($text); $site = explode(". ", $text); if(is_array($site)) foreach ($site AS $key => $satz){ $satz = preg_replace('/[^a-z0-9-üßäö]+\s/', ' ', $satz); $satz = preg_replace('/[^a-z0-9-üßäö\s]+/', '', $satz); $site[$key] = explode(" ", $satz); } $paragraph = array(); if(is_array($site)) foreach ($site AS $key => $satz){ $paragraph[] = array("sentence" => $satz); } $json = array("titel" => $title, "id" => "id", "link" => "link", "context" => array(array("paragraph" => $paragraph)) ); $json = json_encode($json); print_r($json);
Output for 5.2.0 - 7.1.0
{"titel":"","id":"id","link":"link","context":[{"paragraph":[{"sentence":["","wort","1","t","glich","wort","2"]}]}]}
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/mjns4 on line 53
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/mjns4 on line 53
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/mjns4 on line 53
Process exited with code 255.
Output for 4.3.0 - 4.3.1

Process exited with code 139.