Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.