PHP Questions Home
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

What is the use of file in php?


The file function returns the contents of a file as an array, with one line per element in the array.

For instance, if I have a file that contains this:

Hello
This
Is
My
File

Then this is how the file function returns it:

<?php

$contents 
file("myfile.txt");
print_r($contents);
?>


which prints

Array
(
[0] => Hello
[1] => This
[2] => Is
[3] => My
[4] => File
)



ASK A QUESTION

More files PHP Questions

Hello, I have a php file that has octet binary numbers in it. How can I see the actual wording? This is an example of how it look: 00111010 11010010 And so on.

how do i upload a file to database

Would like to create a web page by using the contents of file#1 as input, writing contents of a variable as content, and ending with contents of file#2. Would you please help me learn how to do this? Here is my attempt: $in1 = 'input1.html'; $in2 =

Where is a text file i created kept?

the visitor fills out an entire page of text. It is saved then later pulled up and edited. What kind of file? How is it saved? How is it accessed?



Custom Search