3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* This is an untested re-scripting of Luis' posted snippet. * I am mostly avoiding single-use variables and separating "processing" from "displaying" portions of code * I am have added spaces when concatenating with dots, and between function parameters. * The addition of the head tags is only done if the option and view parameters are satisfactory. * Finally, it may be a good idea to call addcslashes($string, '"') on your variables for stability */ if (JRequest::getCmd('option') === "com_content" && JRequest::getCmd('view') === "article") { $doc =& JFactory::getDocument(); $article =& JTable::getInstance("content"); $article->load(strstr(JRequest::getString('id'), ':', true)); $twitterTitle = mb_strimwidth(strip_tags($article->get("title")), 0, 225, " ..."); $twitterDescription = mb_strimwidth(strip_tags($doc->getMetaData('description')), 0, 225, " ..."); $introImage = 'http://yourdomain.com/' . json_decode($article->get("images"))->image_intro; $doc->addCustomTag(' <meta name="twitter:title" content="{$twitterTitle}"/> <meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:site" content="yoursite"/> <meta name="twitter:creator" content="yourcreator"/> <meta name="twitter:url" content="' . JURI::current() . '"/> <meta name="twitter:description" content="{$twitterDescription}"/> <meta name="twitter:image" content="{$introImage}"/> '); }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Class "JRequest" not found in /in/qvj0M:9 Stack trace: #0 {main} thrown in /in/qvj0M on line 9
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
68.15 ms | 401 KiB | 8 Q