<?php foreach ($videos as $video): ?> <iframe width="420" height="345" src="https://www.youtube.com/embed/6t8GF30hs0E"> </iframe> <?php endforeach; ?> 

Dont know how to do that, GUYS? Need to format https://www.youtube.com/watch?v=6t8GF30hs0E to https://www.youtube.com/embed/6t8GF30hs0E Need Regex

Closed due to the fact that off-topic participants ReinRaus , cheops , Nicolas Chabanovsky Jun 25 '16 at 5:09 .

  • Most likely, this question does not correspond to the subject of Stack Overflow in Russian, according to the rules described in the certificate .
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 2
    I vote for closing this question as not relevant, because the question is asked in a language other than Russian - ReinRaus

1 answer 1

Why regexp here, if the usual str_replace enough?

 $video = str_replace("watch?v=", "embed", $video);