PHP functions Usage

PHP functions Usage

1. Convert ASCII line into HTML line breaks

We can display text fetched from database or HTML form. In these cases all paragraphs merged together and displayed in a single line.

To change these, we can convert all Ascii line breaks into HTML line breaks using nl2br() in-built function.

<?php
$input = “This is
sample text
which is break into separate lines”;
echo nl2br( $input );
?>

2. Find filesize in kilobytes

The following example will display file size in kilobytes

echo number_format(filesize($filename)/1024).” Kb”;

 

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.