FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » strange behaviour - fwrite
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
strange behaviour - fwrite [message #27585] Tue, 13 September 2005 16:47 Go to previous message
!alex is currently offline  !alex   Germany
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
[Message index]
 
Read Message
Read Message
Previous Topic: Some clients receive Registration email, Some don't?
Next Topic: Undefined Index Troubles... [Help Please]
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 15:52:34 GMT 2024

Total time taken to generate the page: 0.04463 seconds