Skip to content

Instantly share code, notes, and snippets.

@jonathaningram
Created May 3, 2012 02:08
Show Gist options
  • Save jonathaningram/2582556 to your computer and use it in GitHub Desktop.
Save jonathaningram/2582556 to your computer and use it in GitHub Desktop.
Changing is_null($x) to null === $x or !is_null($x) to null !== $x in PHP
#!/bin/bash
# Assume we look in tmp
# For is_null
find tmp/ -type f -name "*.php" -exec sed -i -r 's#\([^\!]\)is_null\s*(\([^()]*\))#\1\2 === null#g' {} \;
# For !is_null
find tmp/ -type f -name "*.php" -exec sed -i -r 's#[\!]is_null\s*(\([^()]*\))#\1 !== null#g' {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment