Jump to content

vbCrLf in php?


enrmpaga

Recommended Posts

I don't have any VB/ASP programming background but what does that code do?

 

EDIT: Sorry should of done my homework first. I believe the vbCrLf allows for a newline to be outputted. If thats the case then the PHP equivalent is the PHP_EOL constant, eg:

 

echo 'Hello ' . PHP_EOL . ' World'; 
/* OUTPUT:
Hello
World */

 

Link to comment
https://forums.phpfreaks.com/topic/98045-vbcrlf-in-php/#findComment-501652
Share on other sites

um its not working.

 

I'm attempting to to display a record from a database in a list format. Its displaying as a list just fine but just as just one list item. I want it to break line e.g.

 

<ul>

</li></li>

</li></li>

</li></li>

</ul>

 

at the moment its just displaying one <li>

Link to comment
https://forums.phpfreaks.com/topic/98045-vbcrlf-in-php/#findComment-501773
Share on other sites

do you mean

<?php
$str = "the cat\r\nsat\r\non the mat";

$arr = explode (PHP_EOL, $str);

echo "<ul>\n";
foreach ($arr as $item)
{
    echo "<li>$item</li>\n";
}
echo "</ul>\n";
?>

-->
<ul>
<li>the cat</li>
<li>sat</li>
<li>on the mat</li>
</ul>

Link to comment
https://forums.phpfreaks.com/topic/98045-vbcrlf-in-php/#findComment-501789
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.