downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/migration51.errorcheck.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/migration51.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'migration51.errorcheck.php',
   
1 => 'Checking for E_STRICT',
  ),
 
'up' =>
  array (
   
0 => 'migration51.php',
   
1 => 'Migrating from PHP 5.0.x to PHP 5.1.x',
  ),
 
'prev' =>
  array (
   
0 => 'migration51.databases.php',
   
1 => 'Changes in database support',
  ),
 
'next' =>
  array (
   
0 => 'migration5.php',
   
1 => 'Migrating from PHP 4 to PHP 5.0.x',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="migration51.errorcheck" class="section">
  <h2 class="title">Checking for <b><tt class="constant">E_STRICT</tt></b></h2>
  <div class="informalexample">
   <p class="para">
    If you only have a single script to check, you can pick up
    <b><tt class="constant">E_STRICT</tt></b> errors using PHP&#039;s commandline lint
    facility:
   </p>
   <div class="example-contents programlisting"><br />
    php -d error_reporting=4095 -l script_to_check.php<br />
   </div>

   <p class="para">
    For larger projects, the shell script below will achieve the same task:
   </p>
   <div class="example-contents programlisting">
<div class="shellcode"><pre class="shellcode">#!/bin/sh

directory=$1

shift

# These extensions are checked
extensions=&quot;php inc&quot;

check_file ()
{
  echo -ne &quot;Doing PHP syntax check on $1 ...&quot;

  # Options:
  ERRORS=`/www/php/bin/php -d display_errors=1 -d html_errors=0 -d error_prepend_string=&quot; &quot; -d error_append_string=&quot; &quot; -d error_reporting=4095 -l $1 | grep -v &quot;No syntax errors detected&quot;`

  if test -z &quot;$ERRORS&quot;; then
    echo -ne &quot;OK.&quot;
  else
    echo -e &quot;Errors found!\n$ERRORS&quot;
  fi

  echo
}

# loop over remaining file args
for FILE in &quot;$@&quot; ; do
  for ext in $extensions; do
     if echo $FILE | grep &quot;\.$ext$&quot; &gt; /dev/null; then
       if test -f $FILE; then
         check_file &quot;$FILE&quot;
       fi
     fi
  done
done</pre>
</div>
   </div>

  </div>
 </div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites