Created
January 29, 2017 10:06
-
-
Save phpfiddle/b01960d50d4b97c4ec8037b7a3b3d118 to your computer and use it in GitHub Desktop.
[ Posted by Mohammad ] Convert Tag img to array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Convert Tag img to array | |
* (src) OR (src|alt|class|...) | |
**/ | |
$img_tag = '<img class="vote-up" src="/content/img/vote-arrow-up.png" alt="vote up" title="This was helpful (click again to undo)" />'; | |
preg_match('/(src)=("[^"]*")/i',$img_tag, $src); | |
echo '<pre>'; | |
print_r($src); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment