File Delete in PHP

PHP – File Delete PHP – File Unlink When you view the contents of a directory you can see all the files that exist in that directory because the operating system or application that you are using displays a list of filenames. You can think of these filenames...
Continue reading »

Write/Read Function in PHP

PHP – Write/Read Function File Write Lets get on to the most useful part of file manipulation, writing. There is really only one main function that is used to write and it’s logically called fwrite. File Open : Write Before we can write information to our test file...
Continue reading »

File Close in PHP

PHP – File Close The next step after you have opened a file is to close that file. Description In PHP it is not system to close all your files after using them because the server will close all files after the PHP code finishes execution. File Close...
Continue reading »

fopen () Function in PHP

fopen () PHP Function Definition: Opens a file in PHP to read, write, or rewrite to. It is phrased as fopen ( filename, mode) Modes: r – Reading only, beginning of file r+ – Reading and writing, beginning of file w – Writing only, beginning of file w+...
Continue reading »

File Create in PHP

PHP – File Creation Creating file using fopen() Using the PHP file system function fopen(), we can create a new file. Let’s look at this function more closely. fopen ($filename, $mode); The function fopen() takes in two arguments, the filename and the mode to either open or create...
Continue reading »

Post & Get method in PHP

PHP Post & Get method HTML Code Excerpt: <form action=”process.php” method=”post”> <select name=”item”> … <input name=”quantity” type=”text” /> This HTML code specifies that the form data will be submitted to the “process.php” web page using the POST method. The way that PHP does this is to store all the...
Continue reading »

PHP – Do While Loop

Do While Loop in PHP A “do while” loop is a slightly modified version of the while loop. If you recal from one of the previous lessons on While Loops the conditional statement is checked comes back true then the code within the while loop is executed. If...
Continue reading »

foreach loop in PHP

PHP foreach loop To understand FOREACH loops you have to remember what we learned about arrays. If you recall an array (unlike a variable) contains a group of data. When using a loop with an array, instead of having a counter that goes until proven false the FOREACH...
Continue reading »

For loop in PHP

PHP for loop A FOR loop is very similar to a WHILE loop in that it continues to process a block of code until a statement becomes false, however everything is defined in a single line. The basic structure for a FOR loop is: for ( start; conditional;...
Continue reading »

While Loop in PHP

PHP While Loop In PHP there are several different types of loops. Basically what a loop does is evaluate a statement as true or false. If it is true it executes some code and then alters the original statement and starts all over again by re-evaluating it. It...
Continue reading »