PHP Forum

PHP Forum (http://www.selfphp.de/forum/index.php)
-   PHP für Fortgeschrittene und Experten (http://www.selfphp.de/forum/forumdisplay.php?f=13)
-   -   $this-> auf ein Array (http://www.selfphp.de/forum/showthread.php?t=12122)

freude 09.01.2006 17:48:13

$this-> auf ein Array
 
Hallo Leute,
wenn ich versuch ein Array auszulesen, kommt es immer zu einem Fehler. Der String sieht so aus:
PHP-Code:

$this->Tabelle ="<img src=\"$this->ThumbLink[0]\" hspace=\"$this->hspace\"  ...> 

im Quelltext erscheint dann so was: Array[0].
Wenn ich aber schreibe:
PHP-Code:

print_r($this->ThumbLink[0]); 

oder
PHP-Code:

$test$this->ThumbLink[0]; 

und
PHP-Code:

echo $test

mach, ist alles super.
Komisch das Ganze.
Kann mir jemand weiterhelfen?? Vielen Dank.

freude

meikel (†) 09.01.2006 18:51:43

AW: $this-> auf ein Array
 
Zitat:

Zitat von freude
Der String sieht so aus:
PHP-Code:

$this->Tabelle ="<img src=\"$this->ThumbLink[0]\" hspace=\"$this->hspace\"  ...> 

im Quelltext erscheint dann so was: Array[0].

PHP erkennt in Gänsefuß-Strings zwar Variable und Arrays aber keine Objekte.

freude 09.01.2006 19:17:01

AW: $this-> auf ein Array
 
PHP-Code:

hspace="$this->hspace\" 

funktioniert aber.

An die Forum-Progger: Mein erstes Backslash ist verschwunden: hspace=\"$this->hspace\" !!

meikel (†) 09.01.2006 21:03:00

AW: $this-> auf ein Array
 
Fürchterliche Escapeorgien!
PHP-Code:

$this->Tabelle sprintf('<img src="%s" hspace="%s"  ...>'
$this->ThumbLink[0],
$this->hspace); 



Alle Zeitangaben in WEZ +2. Es ist jetzt 04:37:18 Uhr.

Powered by vBulletin® Version 3.8.3 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.