How do I list all blocks with PHP enabled inside?
If you want to find all custom blocks that have PHP code as their input format, you can query the block_custom table. The format column will contain the key php_code.

$blocks = db_select('block_custom')
  -&gt;fields('block_custom')
  -&gt;condition('format', 'php_code')
  -&gt;execute();
foreach($blocks as $block) {
  // @TODO: Add your own actionable code
}