Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OOP
#16
PHP Code:
// ... entfehrnt weil die backslashes gelöscht werden (bsp 4)
(Quelle: http://de2.php.net/manual/de/language.na...ltiple.php)

Sieht zwar scheiße aus aber gut, ich werde es nicht gebrauchen -.-

Achja und deine Text Klasse ist doch kein wirkliches OOP, besser wäre:

PHP Code:
class Text { private $string = ""; public function __construct($text) { $this->string = $text; } public function toHtml() { $string = stripslashes($this->string); $string = htmlentities($string); $this->string = nl2br($string); } public function fetch() { return $this->string; } } // Beispiel: $text = new Text("Ich lese keine Pornoheftchen ;)"); $text->toHTML(); echo $text->fetch();

Das ist OOP weil jetzt kannst du das ganze ganz bequem erweitern und den text anderst manipulieren Wink

Sorry für die schlechte formatierung, mein eclipse spinnt iwie grade oO

~a
Reply


Messages In This Thread
OOP - by Ephelian - 14.01.2009, 23:08
RE: OOP - by agent47 - 14.01.2009, 23:37
RE: OOP - by Ephelian - 14.01.2009, 23:48
RE: OOP - by agrafix - 17.01.2009, 13:38
RE: OOP - by agent47 - 14.01.2009, 23:56
RE: OOP - by Ephelian - 29.01.2009, 20:51
RE: OOP - by agent47 - 29.01.2009, 21:01
RE: OOP - by Ephelian - 29.01.2009, 21:43
RE: OOP - by agent47 - 29.01.2009, 21:52
RE: OOP - by Ephelian - 29.01.2009, 22:06
RE: OOP - by agent47 - 29.01.2009, 22:09
RE: OOP - by Ephelian - 29.01.2009, 22:14
RE: OOP - by agent47 - 29.01.2009, 22:23
RE: OOP - by jumpa - 30.01.2009, 13:54
RE: OOP - by agent47 - 30.01.2009, 14:49
RE: OOP - by agrafix - 30.01.2009, 20:13
RE: OOP - by agent47 - 30.01.2009, 22:17
RE: OOP - by Ephelian - 07.04.2009, 19:34
RE: OOP - by Milu2K - 07.04.2009, 19:44
RE: OOP - by Ephelian - 07.04.2009, 19:56
RE: OOP - by agrafix - 11.04.2009, 21:53



Users browsing this thread: 1 Guest(s)