Files
- $file = fopen('foo.txt', 'r')
- $file = fopen('foo2.txt', 'w')
- $file = fopen('foo3.txt', 'a')
- $line = fgets($file)
- $string = fread($file, $numberOfBytes)
- fwrite($file, $text)
- fclose($file)
- $text = file_get_contents('foo.txt')
- file_put_contents('foo2.txt',$outputText)
Some other useful functions
- $string2 = trim($string)
- $arr = explode(' ', $string)
- print_r($arr)
- $numItems = count($arr)
- $n = rand(0,10)
In class
Extend random sentence script to generate multiple sentences, and include random images, chosen from
http://davepape.org/ub/dms315/06/imagelist.txt
This document is by Dave Pape, and is released under a Creative Commons License.