I need to extract a specific letter or number from string.
<div id="craftysyntax_1" style="float: right;"><script type="text/javascript" src="https://livehelp.clipboards.com/livehelp_js.php?eo=0&department=1&serversession=1&pingtimes=10&dynamic=Y&creditline=W"></script></div>
From this div with id="craftysyntax_1"
I want to extract just the number 1 from this craftysyntax_1, i am trying with explode but it does not work for me or maybe I am doing something wrong.
Here is what I have tried :
$myString = '<div id="craftysyntax_1" style="float: right;"><script type="text/javascript" src="https://livehelp.clipboards.com/livehelp_js.php?eo=0&department=1&serversession=1&pingtimes=10&dynamic=Y&creditline=W"></script></div>';
$strArray = explode('craftysyntax_', $myString, 1);
print_r($myString);
How can I achieve what I want?