3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 5.1.0 - 5.2.17, 7.0.0 - 7.1.0
Fatal error: Class 'eZPersistentObject' not found in /in/LC53Y on line 5
Process exited with code 255.
Output for 5.3.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.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.