note 57122 added to control-structures.foreach
| From: | Oto | Date: | Sat, 24 Sep 2005 13:14:37 +0000 |
| Subject: | note 57122 added to control-structures.foreach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95707@lists.php.net to get a copy of this message | ||
You can use you'r own function for creating xml/html tags.
Function :
function tag($tag,$string,$atrib = false){
if(!is_array($atrib)){
return "<".$tag.">".$string."</".$tag.">";
} else {
$o = "<".$tag;
foreach($atrib as $key => $val){
$o .= " ".$key."=\"".$val."\"";
};
$o .= ">".$string."</".$tag.">";
return $o;
};
}
Usage:
$array[href] = "http://www.php.net";
$array[id] = "testcss";
$array[class] = "simplecssclass";
print(tag("a","PHP Home Page,$array));
Output:
<a href="http://www.php.net"
id="testcss" class="simplecssclass">PHP Home Page</a>
You can use this function without attributes. Like this:
print(tag("b",Bold text));
Output:
<b>Bold text</b>
----
Manual Page -- http://www.php.net/manual/en/control-structures.foreach.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57122
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57122&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57122&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57122&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57122&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57122&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57122&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57122&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57122&report=yes
Search -- http://master.php.net/manage/user-notes.php