|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-11-16 13:12 UTC] no367 at vip dot qq dot com
Description:
------------
<?php
namespace test;
function text( array $arr ){
print_r($arr);
}
//not working
text('text');
Test script:
---------------
<?php
namespace test;
function test( array $arr ){
print_r($arr);
}
//not working
test('test');
<?php
function test( array $arr ){
print_r($arr);
}
//is working
test('test');
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 08 01:00:01 2026 UTC |
In fact this is the case. <?php namespace test; function error( $type, $message, $file, $line ){ static $error; $error[] = array( 'type' => $type, 'message' => $message, 'file' => $file, 'line' => $line, 'fatal' => false ); } set_error_handler( 'test\error' ); function test_array( array $arr ){ print_r($arr); } var_dump( error_get_last() ); //why is null ? test_array('test'); //why is print test ok?Sorry,The above code is wrong. <?php namespace test; function error( $type, $message, $file, $line ){ static $error; $error[] = array( 'type' => $type, 'message' => $message, 'file' => $file, 'line' => $line, 'fatal' => false ); } set_error_handler( 'test\error' ); function test_array( array $arr ){ print_r($arr); } test_array('test'); //why is print test ok? var_dump( error_get_last() ); //why is null ?