A
A
Andrew2015-12-02 09:44:42
PHP
Andrew, 2015-12-02 09:44:42

How to get the content of a document?

Is it possible to get the content between <?php AB?> with php?

<?php A?>

<html>
документ
</html>

<?php B?>

Is it possible to get them inside the document so that as a result of "magic" in the <?php B?> block I could see and manipulate everything above it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sunrails, 2015-12-02
@15megatonn

Use php.net/manual/ru/ref.outcontrol.php

V
Vladislav, 2015-12-02
@MrBikus

With regular expressions:
$html= "<?php A?>document<?php B?>";
preg_match("/<\?php A\?>(.*?)<\?php B\?>/", $html, $matches);
var_dump($matches);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question