FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » list() Struktur auslagern
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: list() Struktur auslagern [message #176700 is a reply to message #176699] Wed, 18 January 2012 19:44 Go to previous messageGo to previous message
Erwin Moller is currently offline  Erwin Moller
Messages: 228
Registered: September 2010
Karma:
Senior Member
On 1/18/2012 5:34 PM, Maximilian Koch wrote:
> Hallo NG
>
> ich möchte aus einer CSV datei die inhalte auslesen, diese können sich
> jedoch mal ändern in der reihenfolge. und es wird danach umständlich an
> mehreren orten im PHP Script die sache zu ändern..
>
> gäbe es nicht eine möglichkeit diese auszulegen..
>
> in etwa so:
> ------------------------------
>
> $datenstruktur = "$land, $artnrCH, $artnrAT, $artnrDE, $rezepturnummer,
> $artikel, $reichweiteintagen, $reichweitebismbintagen, $istbestand,
> $planPPS, $reservation, $planrwbismbintagen, $mindestbestand, $netogewicht,
> $me, $kostenstelle, $MHD, $vepal, $gebch, $chrez, $schnitt3M, $schnitt6M,
> $schnitt12M, $schnitttotal";
>
> foreach ($datenbank as $datenbank_temp)
> {
> list($dispoliste_datenstruktur) = explode(";",
> $datenbank_temp);
> }
> ----------------------------------------------
>
> allerdings funktioniert das so nicht. kann mir jemand weiterhelfen?
>
> Danke
>
>


[In English: I can read German a little, but not produce it.]

You command:
explode(";",$datenbank_temp);
will explode on ;

For example:
$myPartsArray = explode(",","eins,zwei,drei");

Now you have 3 elements in your array:
$myPartsArray[0] <-- "eins"
$myPartsArray[1] <-- "zwei"
$myPartsArray[2] <-- "drei"


Looking at your example you want to explode on "," and not on ";".

Also: You use list(), which makes no sense like that.
Explode() already returns an array, so you can just do:

$dispoliste_datenstruktur = explode(",",$datenbank_temp);

That way you'll have all in the array $dispoliste_datenstruktur.

You can always check what is inside some array quickly using the handy
function print_r(), like this:

echo "<pre>";
print_r($dispoliste_datenstruktur);
echo "</pre>";

In case I didn't answer your question at all, which is very possible,
just ask again. :-)

Regards,
Erwin Moller

--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: HTTP headers and header()
Next Topic: Loading globals into classes
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 06:50:36 GMT 2024

Total time taken to generate the page: 0.04344 seconds