3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = '{ifvar[?]}<tr> <td class="padding-left20 padding-right20" style="padding: 5px 40px 0 40px; background-color: #f8f8f8;"> <span class="size24" style="display: block; font-size: 24px; color: #472786; font-weight: bold; line-height: 1;"> Enjoy our internal messaging system </span> <span class="size14" style="display: block;"> What does it give you? A Casting Professional who is looking to find talent for their projects with AllCasting.com, can initiate a conversation with our members through our easy to use Messaging System. If there\'s a casting call in your area that perfectly matches your profile, you\'ll get notified as well! </span> <span class="size14" style="display: block; padding: 10px 0 0 0;"> You have <span style="font-style: italic; color: #472786; font-weight: bold;"> ? UNREAD message{plural[{GES_UNREAD_CONVERSATIONS}]}s{/plural}</span> from agents and casting directors! </span> <span style="display: block; max-width: 210px; padding: 30px 0 0 0;" class="btnFullWidth size14"> <span class="desktop-btn" style="display: block; text-align: center; padding: 10px 18px 9px 18px; background-color: #2bb672; border-radius: 5px 5px 5px 5px;"> <a href="{GES_SINGLE_LOGIN_URL}&goto=/messages" style="display: block; text-align: center; text-decoration: none; vertical-align: middle; text-transform: uppercase;"> <span style="display: block; font-size: 14px; font-weight: bold; color: #ffffff; line-height: 1.4;">view all messages</span> </a> </span> </span> </td> </tr> <tr> <td style="padding:0;"> <span style="display: block; height: 0; padding: 10px 0 0 0;">&nbsp;</span> </td> </tr> {/ifvar}'; /* echo '<pre style="color:green">'; echo htmlentities($text); echo '</pre>'; */ echo '<pre style="color:red">'; echo htmlentities(_replaceIfVarTags($text)); echo '</pre>'; function _replaceIfVarTags($text) { // $text = iconv("UTF-8", "UTF-8//IGNORE", $text); $regexp = '/\\{!?ifvar\\[(.*?)(?=\\]})\\]\\}(([\\s\\S](?!\\{!?ifvar))*?)\\{\\/ifvar\\}/i'; preg_match_all($regexp, $text, $matches); echo '<hr><pre style="color:black">'; echo htmlentities(print_r($matches,1)); echo '</pre><hr>'; if (!$matches || !$matches[0]) return $text; foreach ($matches[0] as $k => $v) { $value = trim($matches[1][$k]); if (strpos($v, '{!ifvar') === false) { if (in_array($value, ['', '0', 0, false, 'false', null], true)) { $text = str_replace($v, '', $text); } else { $text = str_replace($v, $matches[2][$k], $text); } } else { if ($value === '') { $text = str_replace($v, $matches[2][$k], $text); } else { $text = str_replace($v, '', $text); } } } //return _replaceIfVarTags($text); }

Abusive script

This script was stopped while abusing our resources

Output for rfc.property-hooks, git.master, git.master_jit
<pre style="color:red"><hr><pre style="color:black">Array ( [0] =&gt; Array ( [0] =&gt; {ifvar[?]}&lt;tr&gt; &lt;td class=&quot;padding-left20 padding-right20&quot; style=&quot;padding: 5px 40px 0 40px; background-color: #f8f8f8;&quot;&gt; &lt;span class=&quot;size24&quot; style=&quot;display: block; font-size: 24px; color: #472786; font-weight: bold; line-height: 1;&quot;&gt; Enjoy our internal messaging system &lt;/span&gt; &lt;span class=&quot;size14&quot; style=&quot;display: block;&quot;&gt; What does it give you? A Casting Professional who is looking to find talent for their projects with AllCasting.com, can initiate a conversation with our members through our easy to use Messaging System. If there&#039;s a casting call in your area that perfectly matches your profile, you&#039;ll get notified as well! &lt;/span&gt; &lt;span class=&quot;size14&quot; style=&quot;display: block; padding: 10px 0 0 0;&quot;&gt; You have &lt;span style=&quot;font-style: italic; color: #472786; font-weight: bold;&quot;&gt; ? UNREAD message{plural[{GES_UNREAD_CONVERSATIONS}]}s{/plural}&lt;/span&gt; from agents and casting directors! &lt;/span&gt; &lt;span style=&quot;display: block; max-width: 210px; padding: 30px 0 0 0;&quot; class=&quot;btnFullWidth size14&quot;&gt; &lt;span class=&quot;desktop-btn&quot; style=&quot;display: block; text-align: center; padding: 10px 18px 9px 18px; background-color: #2bb672; border-radius: 5px 5px 5px 5px;&quot;&gt; &lt;a href=&quot;{GES_SINGLE_LOGIN_URL}&amp;goto=/messages&quot; style=&quot;display: block; text-align: center; text-decoration: none; vertical-align: middle; text-transform: uppercase;&quot;&gt; &lt;span style=&quot;display: block; font-size: 14px; font-weight: bold; color: #ffffff; line-height: 1.4;&quot;&gt;view all messages&lt;/span&gt; &lt;/a&gt; &lt;/span&gt; &lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;padding:0;&quot;&gt; &lt;span style=&quot;display: block; height: 0; padding: 10px 0 0 0;&quot;&gt;&amp;nbsp;&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; {/ifvar} ) [1] =&gt; Array ( [0] =&gt; ? ) [2] =&gt; Array ( [0] =&gt; &lt;tr&gt; &lt;td class=&quot;padding-left20 padding-right20&quot; style=&quot;padding: 5px 40px 0 40px; background-color: #f8f8f8;&quot;&gt; &lt;span class=&quot;size24&quot; style=&quot;display: block; font-size: 24px; color: #472786; font-weight: bold; line-height: 1;&quot;&gt; Enjoy our internal messaging system &lt;/span&gt; &lt;span class=&quot;size14&quot; style=&quot;display: block;&quot;&gt; What does it give you? A Casting Professional who is looking to find talent for their projects with AllCasting.com, can initiate a conversation with our members through our easy to use Messaging System. If there&#039;s a casting call in your area that perfectly matches your profile, you&#039;ll get notified as well! &lt;/span&gt; &lt;span class=&quot;size14&quot; style=&quot;display: block; padding: 10px 0 0 0;&quot;&gt; You have &lt;span style=&quot;font-style: italic; color: #472786; font-weight: bold;&quot;&gt; ? UNREAD message{plural[{GES_UNREAD_CONVERSATIONS}]}s{/plural}&lt;/span&gt; from agents and casting directors! &lt;/span&gt; &lt;span style=&quot;display: block; max-width: 210px; padding: 30px 0 0 0;&quot; class=&quot;btnFullWidth size14&quot;&gt; &lt;span class=&quot;desktop-btn&quot; style=&quot;display: block; text-align: center; padding: 10px 18px 9px 18px; background-color: #2bb672; border-radius: 5px 5px 5px 5px;&quot;&gt; &lt;a href=&quot;{GES_SINGLE_LOGIN_URL}&amp;goto=/messages&quot; style=&quot;display: block; text-align: center; text-decoration: none; vertical-align: middle; text-transform: uppercase;&quot;&gt; &lt;span style=&quot;display: block; font-size: 14px; font-weight: bold; color: #ffffff; line-height: 1.4;&quot;&gt;view all messages&lt;/span&gt; &lt;/a&gt; &lt;/span&gt; &lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;padding:0;&quot;&gt; &lt;span style=&quot;display: block; height: 0; padding: 10px 0 0 0;&quot;&gt;&amp;nbsp;&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; ) [3] =&gt; Array ( [0] =&gt; ) ) </pre><hr> Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in /in/J8nHk on line 45 </pre>

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:
76.59 ms | 4041 KiB | 4 Q