note 58478 added to function.php-check-syntax

From: Date: Sat, 05 Nov 2005 10:39:08 +0000
Subject: note 58478 added to function.php-check-syntax
Groups: php.notes 
Request: Send a blank email to php-notes+get-98127@lists.php.net to get a copy of this message
According to the NEWS file, this function has been removed since 5.1/5.0.5 But you can use this one: <?php if (!function_exists('php_check_syntax')) { function php_check_syntax($file, &$error) { if (isset($_SERVER['_'])) { $php = $_SERVER['_']; //not sure about this } else { $php = 'php'; }; $result = shell_exec($php.' -l '.$file); if (strpos($result, 'No syntax errors detected') === 0) { include_once $file; //remove this if you wish return 1; } else { $result = str_replace('Errors parsing '.$file, '', $result); $error = trim($result, " \n\r\t"); return 0; }; }; }; ?> ---- Manual Page -- http://www.php.net/manual/en/function.php-check-syntax.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58478 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58478&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58478&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58478&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58478&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58478&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58478&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58478&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58478&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98127) next »