Home »
General »
PHP discussions »
strange behaviour - fwrite
strange behaviour - fwrite [message #27585] |
Tue, 13 September 2005 16:47 |
!alex
Messages: 23 Registered: February 2004 Location: germany
Karma:
|
Junior Member |
|
|
Hi,
i found some strange behaviour with this piece of code:
(btw: should write a xml-playlist for a flash mp3-player)
echo $songs;
if (strlen($songs) ==0) echo 'strlen: 0';
fwrite($h,strlen($songs).'
</Playlist></XML>');
fclose($h);
$songs is a string built previously in a foreach-loop,
when i print $songs to screen the output is like expected:
<Song>
<Name>Reach for the Moon</Name>
<Src>/elements/mp3/1/1/pre/NQ==.mp3</Src>
<Artist></Artist>
</Song>
[....]
The strange thing is that as strlen($songs) 0 (!!!) is written to the file.
I tired to write the string to the file several times, used fiel_put_contents and whatever with no success...
For me it looks like php has 2 different views to the value of $songs ?!
Any ideas how to write the string's content (as displayed by echo) to the file would be great.
Setup is:
Apache/1.3.33 (Unix) PHP/5.0.5 mod_ssl/2.8.22 OpenSSL/0.9.7a
, zend_optimizer.version=2.5.10a
I wouldn't wonder if this is a bug in php (or maybe also the zend-optimizer) ... i made an upgrade to php 5.0.5 ten minutes ago - no success :/
Alex
|
|
|
Goto Forum:
Current Time: Fri Nov 22 21:35:51 GMT 2024
Total time taken to generate the page: 0.03976 seconds