1--TEST-- 2Testing to implement Serializable interface by traits 3--FILE-- 4<?php 5 6trait foo { 7 public function serialize() { 8 return 'foobar'; 9 } 10 public function unserialize($x) { 11 var_dump($x); 12 } 13} 14 15class bar implements Serializable { 16 use foo; 17} 18 19var_dump($o = serialize(new bar)); 20var_dump(unserialize($o)); 21 22?> 23--EXPECTF-- 24string(20) "C:3:"bar":6:{foobar}" 25string(6) "foobar" 26object(bar)#%d (0) { 27} 28