1--TEST-- 2ZE2 Constructor precedence 3--SKIPIF-- 4<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> 5--FILE-- 6<?php 7class Base_php4 { 8 function Base_php4() { 9 var_dump('Base constructor'); 10 } 11} 12 13class Child_php4 extends Base_php4 { 14 function Child_php4() { 15 var_dump('Child constructor'); 16 parent::Base_php4(); 17 } 18} 19 20class Base_php5 { 21 function __construct() { 22 var_dump('Base constructor'); 23 } 24 } 25 26class Child_php5 extends Base_php5 { 27 function __construct() { 28 var_dump('Child constructor'); 29 parent::__construct(); 30 } 31 } 32 33class Child_mx1 extends Base_php4 { 34 function __construct() { 35 var_dump('Child constructor'); 36 parent::Base_php4(); 37 } 38} 39 40class Child_mx2 extends Base_php5 { 41 function Child_mx2() { 42 var_dump('Child constructor'); 43 parent::__construct(); 44 } 45} 46 47echo "### PHP 4 style\n"; 48$c4= new Child_php4(); 49 50echo "### PHP 5 style\n"; 51$c5= new Child_php5(); 52 53echo "### Mixed style 1\n"; 54$cm= new Child_mx1(); 55 56echo "### Mixed style 2\n"; 57$cm= new Child_mx2(); 58?> 59--EXPECT-- 60### PHP 4 style 61string(17) "Child constructor" 62string(16) "Base constructor" 63### PHP 5 style 64string(17) "Child constructor" 65string(16) "Base constructor" 66### Mixed style 1 67string(17) "Child constructor" 68string(16) "Base constructor" 69### Mixed style 2 70string(17) "Child constructor" 71string(16) "Base constructor" 72