103
103
A number which is only divisible by 1 and itself is called prime number. Numbers 2,
3, 5, 7, 11, 13, 17, etc. are prime numbers.
Example:
<?php
$count = 0;
$num = 2;
while ($count < 15 )
{
$div_count=0;
for ( $i=1; $i<=$num; $i++)
{
if (($num%$i)==0)
{
$div_count++;
}
}
if ($div_count<3)
{
echo $num." , ";
$count=$count+1;
}
$num=$num+1;
}
?
You can append data into file by using a or a+ mode in fopen() function.
Let's see a simple example that appends data into data.txt file.
data.txt
The PHP fwrite() function is used to write and append data into file.
Example
<?php
$fp = fopen('data.txt', 'a');//opens file in append mode
fwrite($fp, ' this is additional text ');
fwrite($fp, 'appending data');
fclose($fp);
Output: data.txt
You can append data into file by using a or a+ mode in fopen() function.
Let's see a simple example that appends data into data.txt file.
data.txt
The PHP fwrite() function is used to write and append data into file.
Example
<?php
$fp = fopen('data.txt', 'a');//opens file in append mode
fwrite($fp, ' this is additional text ');
fwrite($fp, 'appending data');
fclose($fp);
Output: data.txt
You can append data into file by using a or a+ mode in fopen() function.
Let's see a simple example that appends data into data.txt file.
data.txt
The PHP fwrite() function is used to write and append data into file.
Example
<?php
$fp = fopen('data.txt', 'a');//opens file in append mode
fwrite($fp, ' this is additional text ');
fwrite($fp, 'appending data');
fclose($fp);
Output: data.txt
You can append data into file by using a or a+ mode in fopen() function.
Let's see a simple example that appends data into data.txt file.
data.txt
The PHP fwrite() function is used to write and append data into file.
Example
<?php
$fp = fopen('data.txt', 'a');//opens file in append mode
fwrite($fp, ' this is additional text ');
fwrite($fp, 'appending data');
fclose($fp);
Output: data.txt