<?php
try {
    try {
        throw new \RuntimeException("root", 7);
    } catch (\RuntimeException $previous) {
        throw new \UnexpectedValueException("wrapped", 42, $previous);
    }
} catch (\UnexpectedValueException $e) {
    echo $e->getMessage() . ":" . $e->getCode() . "\n";
    echo $e->getPrevious()->getMessage() . ":" . $e->getPrevious()->getCode() . "\n";
}
