0% found this document useful (0 votes)
100 views2 pages

While False If False: @array (4,9,1,3,2)

This PHP script opens two files, reads through the first file line by line, and copies any line containing "user.php" to the second file. It then closes both files.

Uploaded by

thebhas1954
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views2 pages

While False If False: @array (4,9,1,3,2)

This PHP script opens two files, reads through the first file line by line, and copies any line containing "user.php" to the second file. It then closes both files.

Uploaded by

thebhas1954
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

<?

php
$file = fopen('source.txt', 'rb');
$newfile = fopen('target.txt', 'wb');
while(($line = fgets($file)) !== false) {
if(strpos($line, 'user.php') !== false) {
fputs($newfile, $line);
}
}
fclose($newfile);
fclose($file);
?>

print("This program 'is' designed to find the average of n numbers you input\n")

first_question = 'Would you like to enter a number? (type "yes" if you do)\n\n'
second_question = 'Would you like to enter another number after this? (type "yes" if
you do)\n'

sum_of_numbers = 0
counter = 0
if input(first_question) == "yes" :
sum_of_numbers += int(input("Enter your number here:"))
counter += 1
while input(second_question) == "yes" :
sum_of_numbers += int(input("Enter your next number here: "))
counter += 1
print("Your average is " + str(sum_of_numbers/counter))

@array(4,9,1,3,2);

if(($array[0] > $array[1]) && ($array[0] > $array[2]) && ($array[0] >
$array[3]) && ($array[0] > $array[4])){
print "$array[0] is the largest number in the array\n";
}elsif(($array[1] > $array[0]) && ($array[1] > $array[2]) &&
($array[1] > $array[3]) && ($array[1] > $array[4])){

print "$array[1] is the largest number in the array\n";


}elsif(($array[2] > $array[0]) && ($array[2] > $array[1]) &&
($array[2] > $array[3]) && ($array[2] > $array[4])){

print "$array[2] is the largest number in the array\n";


}elsif(($array[3] > $array[0]) && ($array[3] > $array[1]) &&
($array[3] > $array[2]) && ($array[3] > $array[4])){
print "$array[3] is the largest number in the array\n";
}elsif(($array[4] > $array[0]) && ($array[4] > $array[1]) &&
($array[4] > $array[2]) && ($array[4] > $array[3])){

print "$array[4] is the largest number in the array\n";

You might also like