3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait first_trait { function first_function() { echo "From First Trait\n"; } } trait second_trait { use first_trait { second_trait::first_function insteadof first_trait::first_function; first_trait::first_function as second_function; } function first_function() { echo "From Second Trait\n"; } } class first_class { use second_trait; } $obj = new first_class(); // Output: From Second Trait $obj->first_function(); // Output: From First Trait $obj->second_function();
Output for 5.4.18 - 5.4.42, 5.5.24 - 5.5.26, 5.6.8 - 5.6.10
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM), expecting ';' in /in/MAKD0 on line 13
Process exited with code 255.
Output for 5.4.12 - 5.4.17
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM), expecting ';' in /in/G8Q7f on line 13
Process exited with code 255.
Output for 5.4.0 - 5.4.11
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM), expecting ';' in MAKD0 on line 13
Process exited with code 255.
Output for 5.3.28 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/MAKD0 on line 2
Process exited with code 255.
Output for 5.3.22 - 5.3.27
Parse error: syntax error, unexpected T_STRING in /in/G8Q7f on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.21
Parse error: syntax error, unexpected T_STRING in MAKD0 on line 2
Process exited with code 255.

preferences:
192.52 ms | 1395 KiB | 85 Q