diff --git a/plugins/views/views_php_handler_field.inc b/plugins/views/views_php_handler_field.inc
index a455a49..da8dba4 100644
--- a/plugins/views/views_php_handler_field.inc
+++ b/plugins/views/views_php_handler_field.inc
@@ -114,7 +114,10 @@ class views_php_handler_field extends views_handler_field {
   function php_pre_execute() {
     // Execute static PHP code.
     if (!empty($this->options['php_setup'])) {
-      $function = create_function('$view, $handler, &$static', $this->options['php_setup'] . ';');
+      $code = $this->options['php_setup'];
+      $function = function($view, $handler, &$static) use ($code) {
+        eval($code);
+      };
       ob_start();
       $function($this->view, $this, $this->php_static_variable);
       ob_end_clean();
@@ -128,7 +131,10 @@ class views_php_handler_field extends views_handler_field {
   function php_post_execute() {
     // Execute value PHP code.
     if (!empty($this->options['php_value'])) {
-      $function = create_function('$view, $handler, &$static, $row', $this->options['php_value'] . ';');
+      $code = $this->options['php_value'];
+      $function = function($view, $handler, &$static, $row) use ($code) {
+        return eval($code);
+      };
       ob_start();
       foreach ($this->view->result as $i => &$row) {
         $normalized_row = new stdClass;
@@ -149,7 +155,7 @@ class views_php_handler_field extends views_handler_field {
     if (!empty($this->options['use_php_click_sortable']) && !empty($this->php_click_sort_order)) {
       if ($this->options['use_php_click_sortable'] == self::CLICK_SORT_PHP) {
         if (!empty($this->options['php_click_sortable'])) {
-          $this->php_click_sort_function = create_function('$view, $handler, &$static, $row1, $row2', $this->options['php_click_sortable'] . ';');
+          $this->php_click_sort_function = TRUE;
         }
       }
       else {
@@ -175,6 +181,13 @@ class views_php_handler_field extends views_handler_field {
   function php_click_sort($row1, $row2) {
     $factor = strtoupper($this->php_click_sort_order) == 'ASC' ? 1 : -1;
     $function = $this->php_click_sort_function;
+    if (is_boolean($this->php_click_sort_function)) {
+      $code = $this->options['php_click_sortable'];
+      $function = function($view, $handler, &$static, $row1, $row2) use ($code) {
+        return eval($code);
+      };
+    }
+
     if ($this->options['use_php_click_sortable'] == self::CLICK_SORT_PHP) {
       foreach (array('row1' => 'normalized_row1', 'row2' => 'normalized_row2') as $name => $normalized_name) {
         $$normalized_name = new stdClass;
@@ -204,8 +217,6 @@ class views_php_handler_field extends views_handler_field {
    */
   function render($values) {
     if (!empty($this->options['php_output'])) {
-      $this->php_output_lamda_function = create_function('$view, $handler, &$static, $row, $data, $value', ' ?>' . $this->options['php_output'] . '<?php ');
-
       $normalized_row = new stdClass;
       if (empty($this->view->style_plugin->rendered_fields)) {
         foreach ($this->view->field as $id => $field) {
@@ -214,12 +225,18 @@ class views_php_handler_field extends views_handler_field {
           }
         }
       } else {
-        foreach ($this->view->style_plugin->rendered_fields{$this->view->row_index} as $field => $value) {
-          $normalized_row->$field = $value;
+        if (isset($this->view->style_plugin->rendered_fields{$this->view->row_index})) {
+          foreach ($this->view->style_plugin->rendered_fields{$this->view->row_index} as $field => $value) {
+            $normalized_row->$field = $value;
+          }
         }
       }
 
-      $function = $this->php_output_lamda_function;
+      $code = $this->options['php_output'];
+      $function = function($view, $handler, &$static, $row, $data, $value) use ($code) {
+        eval('?>' . $code);
+      };
+
       ob_start();
       $function($this->view, $this, $this->php_static_variable, $normalized_row, $values, isset($values->{$this->field_alias}) ? $values->{$this->field_alias} : NULL);
       $value = ob_get_clean();
