[php]a problem with a string

ok, this code has been before in the AS forum but now is in the correct place
the problem is that $xmlString isn’t saved in the file, the length of the string $xmlString is saved instead. this must be a very simple thing but I really dont know much php.

if($xmlString != NULL){
$file = fopen("tagboard.xml", "w+") or die("Can't open XML file");
if(!fwrite($file, $xmlString)){
	print "Error writing to XML-file";
print $xmlString;}
else {print "No data was sent";}

readfile(FILENAME); returns the length of the file

get_file_contents(FILENAME); returns the file as a string

You mean file_get_contents() function, right??? :slight_smile:
I didn’t know if this function exists… I always used fopen()/fread() combination… Nice… :smiley:

Yes, according to the online PHP manual, file_get_contents uses memory mapping techniques (if supported by your OS), and benchmarking shows it to be up to 6 times faster than other methods.

thank you, thank you. now I can put my xml tagboard to work! :}