3v4l.org

run code in 300+ PHP versions simultaneously
<?php $blocks = [ 'header' => ['html' => '<header>%s</header>'], 'body' => ['html' => '<div>%s</div>'], 'footer' => ['html' => '<footer>%s</footer>'] ]; $elems = [ ]; $json = json_decode('{"header":[{"type":"background","data":{"src":"https://s3-eu-west-1.amazonaws.com/ptfl/panorama/517e910005dd01e736000005.jpg"}},{"type":"title","data":[{"type":"link","data":{"text":"WeDo","href":"http://dev.dotoknow.com/project/view/517e8bcd05dd018f3b00000e"}}]}],"body":[{"type":"post","data":{"text":["DoToKnow is a project like any other. And alike many other projects it is an ongoing process of discussing, building, developing and fine-tuning. On this page we will keep you up to date on any news and features of DoToKnow.","We would like to ask you to stay on-topic within the posts. If you have any questions, have a look at our About or FAQ pages. If they don\'t provide you with the necessary information you can always contact us through feedback@dotoknow.com"],"project":"517e8bcd05dd018f3b00000e","post":0}}],"footer":[{"type":"tags","data":{"text":["DoToKnow","Official Project","News Channel","Developer blog"]}}]}'); $html = ''; foreach($json as $key => $block) { $html .= $blocks[$key]['html']; } print $html;

preferences:
43.83 ms | 402 KiB | 5 Q