Skip to content

Instantly share code, notes, and snippets.

@leotm
Last active June 12, 2016 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leotm/25cf7640e07c4a527fe075f0b45fb7c3 to your computer and use it in GitHub Desktop.
Save leotm/25cf7640e07c4a527fe075f0b45fb7c3 to your computer and use it in GitHub Desktop.
PHP Options/Info Functions
// It seems PDO attributes are set per connection establishment
// Rather than checking if the attribute is what we desire first, if so not executing it at all
// So I wondered, should the PHP options be just set each connection like PDO?
// Refresh
var_dump(memory_get_usage()); // 167704
if (ini_get('error_reporting') != '22527')
ini_set('error_reporting', 'E_ALL');
var_dump(memory_get_usage()); // 167704
// Force refresh
var_dump(memory_get_usage()); // 167704
if (ini_get('error_reporting') != '22527')
ini_set('error_reporting', 'E_ALL');
var_dump(memory_get_usage()); // 167704
// No additional memory usage
// Refresh
var_dump(memory_get_usage()); // 167376
ini_set('error_reporting', 'E_ALL');
var_dump(memory_get_usage()); // 167544
// + 168
// Force refresh
var_dump(memory_get_usage()); // 167600
ini_set('error_reporting', 'E_ALL');
var_dump(memory_get_usage()); // 167768
// + 168
// It seems checking is slightly more optimal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment