How to get html tag value in php
calendar_month 25 Jan 2023 | PHP
In this tutorial, you will learn how to get html tag value in php with example, if you don't know how to get html tag value such as header, paragraph or any other tag value. You can get html tag value by id or class in php. So, if you don't know how to get html tag value in php, just follow this post.
So, let's follow this example to get html tag value in php. I will give you a simple example to get html tag value in php.
index.php
<?php
$htmlEle = "<html><body><h1>Hello World</h1> <p id='para'>This is example paragraph</p></body></html>";
$domdoc = new DOMDocument();
$domdoc->loadHTML($htmlEle);
echo $domdoc->getElementById('para')->nodeValue;
?>
Output:
Buddy! I hope you relished the tutorial, and it was good to see you again. Keep learning. Keep visiting.