3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * */ class CardCommentObject extends eZPersistentObject { /** * @param array $row */ public function __construct($row) { parent::eZPersistentObject($row); } public static function definition() { static $def = array( 'fields' => array( 'id' => array( 'name' => 'id', 'datatype' => 'integer', 'default' => 0, 'required' => true), 'node_id' => array( 'name' => 'node_id', 'datatype' => 'integer', 'default' => '', 'required' => true), 'comment' => array( 'name' => 'comment', 'datatype' => 'string', 'default' => '', 'required' => true) ), 'keys' => array('id'), 'increment_key' => 'id', 'class_name' => 'CardCommentObject', 'name' => 'CardComments'); return $def; } public static function create( array $row = array() ) { $object = new self( $row ); return $object; } public static function getComments($conds=null,$sorts=array( 'node_id' => 'asc') ,$limit = null,$field_filters = null,$custom_conds = null,$asObject = false,$grouping = false, $custom_fields = null, $custom_tables = null){ $objectList = eZPersistentObject::fetchObjectList( self::definition(), $field_filters, $conds , $sorts, $limit , $asObject , $grouping , $custom_fields , $custom_tables , $custom_conds ); return count( $objectList ) > 0 ? $objectList[0]['comment'] : false; } public static function updateCardComments($node_id,$comment){ $db = eZDB::instance(); $cardComment = eZPersistentObject::fetchObject(self::definition(), null, array('node_id'=>$db->escapeString($node_id))); if (is_null($cardComment)){ $cardComment = self::create(array('node_id'=>$db->escapeString($node_id))); } $cardComment->comment = $db->escapeString($comment); $cardComment->store(); } }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught Error: Class "eZPersistentObject" not found in /in/LC53Y:5 Stack trace: #0 {main} thrown in /in/LC53Y on line 5
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Class 'eZPersistentObject' not found in /in/LC53Y:5 Stack trace: #0 {main} thrown in /in/LC53Y on line 5
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
Fatal error: Class 'eZPersistentObject' not found in /in/LC53Y on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28
Fatal error: Class 'eZPersistentObject' not found in /in/LC53Y on line 6
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/LC53Y on line 42
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/LC53Y on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/LC53Y on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/LC53Y on line 10
Process exited with code 255.

preferences:
326.34 ms | 401 KiB | 396 Q