3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '<p class="example">example</p> <p class="example" style="visibility:hidden">example</p> <script type="text/javascript">var example = 1 ....other stuff.... </script>'; $arr = explode(PHP_EOL, $str); var_dump($arr); for($i = 0; $i < count($arr); $i++){ if(strpos("hidden", $arr[$i]) === false){ unset($arr[$i]); } if(strpos("<script", $arr[$i]) === false){ while(!strpos("</script", $arr[$i]) === false){ unset($arr[$i]); $i++; } } } $str = implode(PHP_EOL, $arr); Echo substr_count(strip_tags($str), "example");
Output for git.master, git.master_jit, rfc.property-hooks
array(5) { [0]=> string(30) "<p class="example">example</p>" [1]=> string(59) " <p class="example" style="visibility:hidden">example</p>" [2]=> string(50) " <script type="text/javascript">var example = 1 " [3]=> string(22) " ....other stuff...." [4]=> string(12) " </script>" } Warning: Undefined array key 0 in /in/FWCg9 on line 15 Deprecated: strpos(): Passing null to parameter #2 ($needle) of type string is deprecated in /in/FWCg9 on line 15 Warning: Undefined array key 1 in /in/FWCg9 on line 15 Deprecated: strpos(): Passing null to parameter #2 ($needle) of type string is deprecated in /in/FWCg9 on line 15 Warning: Undefined array key 2 in /in/FWCg9 on line 15 Deprecated: strpos(): Passing null to parameter #2 ($needle) of type string is deprecated in /in/FWCg9 on line 15 0

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:
52.98 ms | 403 KiB | 8 Q