to all new lines in a string is to use the php nl2br() function. This is really great when you want to restore new lines from a user input by a textarea where user input could get into several lines.
<?php
echo nl2br("line1\n line2");
?>
<?php
echo nl2br("line1\n line2");
?>
These are some sample text to show you how to put content like this around the images. This technique is useful when you are writing articles with images. You should remember to set vspace and hspace properties in the img tag to correctly format the content. Look at the following code try it your self |
<table border="0" align="center" width="375">
<tr><td>
<div id="image"><img src="http://kuppiya.com/toplogo2.jpg"
vspace="3" align="left" border="0" hspace="3" /></div>
<div>These are some sample text to show you how to put content
like this around the images. This technique is useful when you are
writing articles with images. You should remember to set
vspace and hspace properties in the img tag to correctly format the
content. Look at the following code try it your self </div>
</td></tr>
</table>
<?php
$first_array = array(1, 2, 3, 4, 5, 6);
$second_array = array(10, 9, 7, 3, 5);
$new_array = array_merge($first_array, $second_array);
echo '<pre>';
print_r($new_array);
echo '</pre>';
/*
OUTPUT
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
[6] => 10
[7] => 9
[8] => 7
[9] => 3
[10] => 5
)
*/
?>
<?php
$my_array = array(1, 2, 3, 3, 4, 4, 1, 5, 6, 6, 7);
$my_unique_array = array_unique($my_array);
echo '<pre>';
print_r($my_unique_array);
echo '</pre>';
/*
OUTPUT:
Array
(
[0] => 1
[1] => 2
[2] => 3
[4] => 4
[7] => 5
[8] => 6
[10] => 7
)
*/
?>
<?php
$my_array = array('Me', 'You');
array_push($my_array, 'Others');
print_r($my_array);
/*
Array
(
[0] => Me
[1] => You
[2] => Others
)
*/
?>
<?php
//get only .gif files from images folder
$files_list = glob("images/*.gif");
foreach($files_list as $files)
{
echo $files;
echo '<br />';
}
?>
<?php
$my_array = array('Hello', 'Bye', 'Kusal', 'kuppiya');
unset($my_array[2]); // remove kusal from array
print_r($my_array);
/*
Result:
Array ( [0] => Hello [1] => Bye [3] => kuppiya )
*/
?>