Array verdwijnt

Gestart doorEleky2 reacties45 weergaven

3 berichten · pagina 1 van 1

Eleky

Lid · Topicstarter

Berichten
3.788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,

Ik ben bezig met een class die daarin een array heeft:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/class"]class[/URL] Classname[COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/private"]private[/URL] [COLOR= #0000BB]$lijst[/COLOR][COLOR= #007700];[/COLOR]
    
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] __construct[COLOR= #007700](){[/COLOR]
        [COLOR= #0000BB]$lijst[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]3[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]4[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]6[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]7[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]8[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]9[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/print_r"]print_r[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$lijst[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #FF8000]// Hier nog meer code[/COLOR]
    [COLOR= #007700]}[/COLOR]
    
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] load[COLOR= #007700]([/COLOR][COLOR= #0000BB]$array[/COLOR][COLOR= #007700]){[/COLOR]
        [URL="http://www.php.net/print_r"]print_r[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$lijst[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #FF8000]// Meer code[/COLOR]
    [COLOR= #007700]}[/COLOR]
?>


Echter verdwijnt de lijst om een of andere rede.
Als ik de class aanmaak echoot hij netjes de lijst, als ik daarna echter load of een andere functie aanroep krijg ik errors omdat $lijst niet bestaat.
Heeft iemand enig idee hoe dit kan?
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
je moet $this->lijst doen. wink
$lijst is nu gewoon lokaal, je wil hem globaal.
0
Eleky

Lid · Topicstarter

Berichten
3.788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oja tuurlijk, wat ontzettend dom!
Dankjewel!
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren