3v4l.org

run code in 300+ PHP versions simultaneously
<?php $site_a['text'] = "täglich"; 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" => $site_a['id'], "link" => "link", "context" => array(array("paragraph" => $paragraph)) ); $json = json_encode($json); print_r($json);
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Function utf8_encode() is deprecated in /in/6uHO7 on line 26 Warning: Undefined array key "id" in /in/6uHO7 on line 51 {"titel":"","id":null,"link":"link","context":[{"paragraph":[{"sentence":["t\u00e4glich"]}]}]}
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Warning: Undefined array key "id" in /in/6uHO7 on line 51 {"titel":"","id":null,"link":"link","context":[{"paragraph":[{"sentence":["t\u00e4glich"]}]}]}
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined index: id in /in/6uHO7 on line 51 {"titel":"","id":null,"link":"link","context":[{"paragraph":[{"sentence":["t\u00e4glich"]}]}]}
Output for 7.3.32 - 7.3.33
{"titel":"","id":null,"link":"link","context":[{"paragraph":[{"sentence":["t\u00e4glich"]}]}]}
Output for 5.2.0 - 5.2.17
Notice: Undefined index: id in /in/6uHO7 on line 51 {"titel":"","id":null,"link":"link","context":[{"paragraph":[{"sentence":["t\u00e4glich"]}]}]}
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Notice: Undefined index: id in /in/6uHO7 on line 51 Fatal error: Call to undefined function json_encode() in /in/6uHO7 on line 53
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Notice: Undefined index: id in /in/6uHO7 on line 51 Fatal error: Call to undefined function: json_encode() in /in/6uHO7 on line 53
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Notice: Undefined index: id in /in/6uHO7 on line 51 Fatal error: Call to undefined function: json_encode() in /in/6uHO7 on line 53
Process exited with code 255.
Output for 4.3.0 - 4.3.1

Process exited with code 139.

preferences:
272.87 ms | 401 KiB | 381 Q