I’m currently working on a website. And I need to use PHP to select a div with a certain class. For example:
<body>
<div class="header"></div>
<div class="other-class"></div>
<div class="one-two-three"></div>
<div class="footer"></div>
</body>
<?php
if(div.hasClass('one-two-three'))
{
//function code here...
}
?>
But keep in mind that I want to use PHP and not jQuery for this…
If you want do manipulate the DOM, prior to sending it to the client then the Dom object is offers what you need. It even has similar methods to what you might know already from JS.
Here’s an overview of the methods at your disposal