Pages tagged with php

I'm still in the process of tagging pages that were migrated from the old site, so for now you're best off using the search engine rather than relying on the tags.

  • Multiple versions of PHP on Gentoo - This document is a brief description of how to get two versions of PHP running on the same system, with different web sites configured to use different versions. I’ve only tried it with minor version i.e. 5.3 and 5.2, so I don’t know whether this will ...
  • Joining arrays in PHP - PHP has many methods to join arrays. The plus + symbol will do a union of two arrays, preserving keys in the first array. array_merge will do a union of two arrays, overwriting keys from the first array. php > $a = array('one' => 'foo', '...
  • PHP Gotchas - PHP is rife with oddities that can trip you up. I’m going to start keeping track of them here. ‘false’ is true PHP casts ‘false’ to true. echo (bool)‘false’ → 1 Other lists There are many sites on the web that collect them. Here are a couple: ...
  • Suppress PHP errors warnings - It’s very easy to suppress php error and warning messages. Simply add the error control operator, @, to the beginning of the command: @include 'whatever' References PHP: Error Control Operators”>PHP: Error Control Operators
  • Read file without php error messages - If you’re using php to read the contents of various files in order to construct a web page, you don’t want a missing file to result in error messages all over the web page. Use the error control operator and a conditional to prevent this happening: $f...
  • PHP modulo operator (%) returns negative numbers - The PHP modulo operator % returns negative numbers. e.g. -3 % 7 == -3. Other languages will wrap the negative to produce a positive number, e.g. -3 % 7 == 4. To implement a true modulo operator, you have to write a custom function: function truemod($...
  • PHP - Joining arrays in PHPPHP GotchasSuppress PHP errors warningsRead file without php error messagesPHP modulo operator (%) returns negative numbers

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top