“;
}
}
// Trait for VoIP Calling (e.g., WhatsApp Call)
trait VoIPCall {
public function call() {
echo “Calling using the internet (VoIP)…“;
}
}
// Smartphone class using both traits
class Smartphone {
use BasicCall, VoIPCall {
BasicCall::call insteadof VoIPCall; // Use BasicCall’s method
VoIPCall::call as internetCall; // Rename VoIPCall method
}
}
// Create an object
$phone = new Smartphone();
$phone->call(); // Output: Calling using SIM card…
$phone->internetCall(); // Output: Calling using the internet (VoIP)…
?>