Load file into array and check it with in_array

Xidos

New Member
I want to check if a value exists in an array made from a text file. This is what I've got so far:\[code\]<?php$array = file($_SERVER['DOCUMENT_ROOT'].'/textfile.txt');if(in_array('value',$array)){ echo 'value exists';}?>\[/code\]I've experimented a little with foreach-loops as well, but couldn't find a way to do what I want.. The values in the text document are separated by new lines.
 
Back
Top