3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $tiaErrorCodeObject = (object) array( 'tiaError' => 'ORA-12345: Some error occurred', ); if (!empty($tiaErrorCodeObject->tiaError) && false !== strpos($tiaErrorCodeObject->tiaError, 'ORA-')) { $tiaError = trim($tiaErrorCodeObject->tiaError); $split = strpos($tiaError, ':'); $tiaErrorCode = (int)substr($tiaError, 4, $split - 1); $tiaErrorDescription = substr($tiaError, $split + 1, strlen($tiaError)); var_dump($tiaErrorCode); var_dump($tiaErrorDescription); }
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
int(12345) string(20) " Some error occurred"