Array problem

Gestart doorAllard5 reacties43 weergaven

6 berichten · pagina 1 van 1

Allard

Lid · Topicstarter

Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Beste,

Ik zit met een probleem. Ik krijg dit te zien:

The string Array was found.


Er moet natuurlijk het woord staan dat in één van de Arrays staat. Hoe kan dat? Dit is mijn script:
[COLOR= #0000BB]<?php
$include_file[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]http://rooster.avoo.nl/ksg/mr-leerling-l/subst_001.htm[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$teachers[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]Dorsthorst[/COLOR][COLOR= #007700];[/COLOR] 
[COLOR= #0000BB]$compare[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$teachers[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$pos[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strpos"]strpos[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$include_file[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$compare[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$pos[/COLOR] [COLOR= #007700]===[/COLOR] false[COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"The string $compare was not found."[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"The string $compare was found."[/COLOR][COLOR= #007700];
}[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$include_file[/COLOR][COLOR= #007700];[/COLOR]
?>
0
Miel

Lid

Berichten
4.462
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$include_file[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]http://rooster.avoo.nl/ksg/mr-leerling-l/subst_001.htm[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$teachers[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$teachers[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]Dorsthorst[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$compare[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$teachers[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$pos[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strpos"]strpos[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$include_file[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$compare[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$pos[/COLOR] [COLOR= #007700]===[/COLOR] false[COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"The string $compare was not found."[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"The string $compare was found."[/COLOR][COLOR= #007700];
}[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$include_file[/COLOR][COLOR= #007700];[/COLOR]
?>


Misschienyummie
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$include_file[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]http://rooster.avoo.nl/ksg/mr-leerling-l/subst_001.htm[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$teachers[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$teachers[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]Dorsthorst[/COLOR][COLOR= #007700];[/COLOR] 

[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$teachers[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$compare[/COLOR][COLOR= #007700])
{[/COLOR]
    
    [COLOR= #0000BB]$compare[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$teachers[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #0000BB]$pos[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strpos"]strpos[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$include_file[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$compare[/COLOR][COLOR= #007700]);[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$pos[/COLOR] [COLOR= #007700]===[/COLOR] false[COLOR= #007700]) {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"The string $compare was not found."[/COLOR][COLOR= #007700];
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"The string $compare was found."[/COLOR][COLOR= #007700];
    }
    
}[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$include_file[/COLOR][COLOR= #007700];[/COLOR]
?>


Zo?
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
@Lennard: $compare = $teachers; moet dan toch weg?
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Oja, klopt.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dan wordt het dus

[COLOR= #0000BB]<?php
$include_file[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]http://rooster.avoo.nl/ksg/mr-leerling-l/subst_001.htm[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$teachers[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$teachers[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]Dorsthorst[/COLOR][COLOR= #007700];[/COLOR] 

[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$teachers[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$compare[/COLOR][COLOR= #007700])
{[/COLOR]
    
    [COLOR= #0000BB]$pos[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strpos"]strpos[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$include_file[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$compare[/COLOR][COLOR= #007700]);[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$pos[/COLOR] [COLOR= #007700]===[/COLOR] false[COLOR= #007700]) {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"The string $compare was not found."[/COLOR][COLOR= #007700];
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"The string $compare was found."[/COLOR][COLOR= #007700];
    }
    
}[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$include_file[/COLOR][COLOR= #007700];[/COLOR]
?>
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