note 50747 added to function.strpos

From: Date: Tue, 08 Mar 2005 19:58:37 +0000
Subject: note 50747 added to function.strpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-86127@lists.php.net to get a copy of this message
Hi folks! This is my first note ever! =) Maybe you php genie already have this function but I want to post it in order to know if it works properly. =) I just want to say I didn't test it many times =P However this function returns all the values of a attribute of a tag :) <?php function getTagAttributeValues($HTMLCode,$daTag,$attribute) { $tag = strtoupper($daTag); // elimino il problema del case-sensitive $srcValues = array(); // preparo l'array da restituire $index = 0; // indice dell'array $tokens = explode($tag,$HTMLCode); // localizzo tutti i token delimitati dal tag for($i=0;$i<sizeof($tokens);$i++){ // scorro i token $tempStr = explode($attribute,$tokens[$i]); // localizzo i token delimitati dall'attributo if ($tempStr[0] != $tokens[$i]) { // se il token e' valido $srcValue = ""; $j=1; while(substr($tempStr[1],$j,1) != "\""){ // scorro fino a trovare il carattere " $srcValue.= substr($tempStr[1],$j++,1); // concateno i caratteri } $srcValues[$index++] = $srcValue; // aggiungo il percorso trovato a quelli da restituire } } return $srcValues; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.strpos.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50747 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50747&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50747&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50747&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50747&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50747&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50747&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86127) next »