You are here: XML parsing of new lines on PHP4 and PHP5 « PHP Programming Language « IT news, forums, messages
XML parsing of new lines on PHP4 and PHP5

Posted by yawnmoth on 11/03/12 11:42

Say I have the following script:

<?php
$contents="<p>test\ntest</p>";

$xml_parser = xml_parser_create('UTF-8'); // try xml_parser_create_ns,
too.
xml_set_character_data_handler($xml_parser,'handler');
xml_parse($xml_parser, $contents);

function handler($parser, $data)
{
static $count=1;
echo "$count. $data<br />";
$count++;
}
?>

When ran on PHP4 (via the web, so new lines are seen as spaces) I get
this:

1. test
2.
3. test

When ran on PHP5 (via the web) I get this:

1. test test

Why the difference? Is there any way to get PHP5 to simulate PHP4's
behavior?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация