3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $body = '<blockquote class="twitter-tweet" data-lang="ja"><p lang="en" dir="ltr">Thank you ! ~ that is all :) <a href="https://t.co/4evflUT84g">pic.twitter.com/4evflUT84g</a></p>— Chicago Police (@Chicago_Police) <a href="https://twitter.cm/Chicago_Police/status/877727536125419520">2017年6月22日</a></blockquote><script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>'; $body = preg_replace_callback('!(<blockquote class="twitter-tweet" data-lang="ja">.*?</blockquote>.+?twitter.com.+?<\/script>)!s', function ($matches) { var_dump($matches); return '[[embed-twitter]](' . trim($matches[2]) . ')'; }, $body); echo $body; ?>
based on pBj53
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.3.0rc3
array(2) { [0]=> string(391) "<blockquote class="twitter-tweet" data-lang="ja"><p lang="en" dir="ltr">Thank you ! ~ that is all :) <a href="https://t.co/4evflUT84g">pic.twitter.com/4evflUT84g</a></p>— Chicago Police (@Chicago_Police) <a href="https://twitter.cm/Chicago_Police/status/877727536125419520">2017年6月22日</a></blockquote><script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>" [1]=> string(391) "<blockquote class="twitter-tweet" data-lang="ja"><p lang="en" dir="ltr">Thank you ! ~ that is all :) <a href="https://t.co/4evflUT84g">pic.twitter.com/4evflUT84g</a></p>— Chicago Police (@Chicago_Police) <a href="https://twitter.cm/Chicago_Police/status/877727536125419520">2017年6月22日</a></blockquote><script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>" } Notice: Undefined offset: 2 in /in/6Vf6c on line 6 [[embed-twitter]]()
Output for hhvm-3.15.4
array(2) { [0]=> string(391) "<blockquote class="twitter-tweet" data-lang="ja"><p lang="en" dir="ltr">Thank you ! ~ that is all :) <a href="https://t.co/4evflUT84g">pic.twitter.com/4evflUT84g</a></p>— Chicago Police (@Chicago_Police) <a href="https://twitter.cm/Chicago_Police/status/877727536125419520">2017年6月22日</a></blockquote><script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>" [1]=> string(391) "<blockquote class="twitter-tweet" data-lang="ja"><p lang="en" dir="ltr">Thank you ! ~ that is all :) <a href="https://t.co/4evflUT84g">pic.twitter.com/4evflUT84g</a></p>— Chicago Police (@Chicago_Police) <a href="https://twitter.cm/Chicago_Police/status/877727536125419520">2017年6月22日</a></blockquote><script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>" } Notice: Undefined index: 2 in /in/6Vf6c on line 6 Warning: trim() expects parameter 1 to be string, null given in /in/6Vf6c on line 6 [[embed-twitter]]()