Php: Difference between revisions

From Adam Colton
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== Misc. ==
* count($arr) : returns array length
* join($glue, $arr)
== Error Log ==
== Error Log ==
   cat /var/log/apache2/error.log
   cat /var/log/apache2/error.log

Revision as of 22:13, 10 February 2016

Misc.

  • count($arr) : returns array length
  • join($glue, $arr)

Error Log

 cat /var/log/apache2/error.log

Arrays

 array_key_exists(key,array);

JSON

 json_decode($str, true);
 json_encode($obj);

The true makes it associative.

Files

 readfile($filename);

Ouputs the file to stdOut.

 file_put_contents($filename, $str);

Write string to file.