Как убрать код из строки php

407
26 января 2017, 05:02

Нужно убрать

<!-- Put this script tag to the <head> of your page --> <script type="text/javascript" src="//vk.com/js/api/openapi.js?137"></script> <!-- Put this div tag to the place, where the Poll block will be -->

из строки с помощью php. Тот текст должен исчезнуть или заменится на пробел. Сама строка состоит из этого

<!-- Put this script tag to the <head> of your page -->
<script type="text/javascript" src="//vk.com/js/api/openapi.js?137"></script>
<!-- Put this div tag to the place, where the Poll block will be -->
<div id="vk_poll"></div>
<script type="text/javascript">
VK.Widgets.Poll("vk_poll", {width: 300}, "252624848_44cf7d2c0b8ed9d470");
</script>
Answer 1
$main_string = '<!-- Put this script tag to the <head> of your page -->
<script type="text/javascript" src="//vk.com/js/api/openapi.js?137"></script>
<!-- Put this div tag to the place, where the Poll block will be -->
<div id="vk_poll"></div>
<script type="text/javascript">
VK.Widgets.Poll("vk_poll", {width: 300}, "252624848_44cf7d2c0b8ed9d470");
</script>';
$pattern = '<!-- Put this script tag to the <head> of your page --> <script type="text/javascript" src="//vk.com/js/api/openapi.js?137"></script> <!-- Put this div tag to the place, where the Poll block will be -->';
$main_string = str_replace($pattern, '', $main_string);
READ ALSO
Как отключить загрузку на сайт контента с других сайтов (Например роликов ютуб)

Как отключить загрузку на сайт контента с других сайтов (Например роликов ютуб)

ПриветЕсть сайт, на нем полно видео роликов которые подтягиваются с ютуб

332
Не понятие apache Header

Не понятие apache Header

Есть домен, допустим mydomenru, на поддомене audio

312
Разделение разрядов в числе

Разделение разрядов в числе

Есть цены в формате - 4000, 200, 40000, 100000, 1000000 и тд

347