3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * 2015-02-17 * Экранирует строку для вставки её в код на JavaScript. * @uses json_encode() рекомендуют * как самый правильный способ вставки строки из PHP в JavaScript: * @link http://stackoverflow.com/a/169035 * Заменяем символ одинарной ковычки его кодом Unicode, * чтобы результат метода можно было вставлять внутрь обрамленной одиночными кавычками строки, * например: var $name = '<?php echo rm_ejs($name); ?>'; * @used-by Df_Admin_Config_DynamicTable_Column::renderTemplate() * @used-by app/design/adminhtml/rm/default/template/df/admin/column/select.phtml * @used-by Df_Admin_Config_DynamicTable_Column::renderTemplate() * @param string $text * @return string */ function rm_ejs($text) {return str_replace("'", '\u0027', trim(json_encode($text), '"'));} /** @var array(string => float) $a */ $a = array('a' => 3.5, 'b' => 5.7); echo rm_ejs($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OlShJ
function name:  (null)
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   21     1        INIT_FCALL                                               'rm_ejs'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function rm_ejs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OlShJ
function name:  rm_ejs
number of ops:  15
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 '%27'
          3        SEND_VAL                                                 '%5Cu0027'
          4        INIT_FCALL                                               'trim'
          5        INIT_FCALL                                               'json_encode'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $1      
          8        SEND_VAR                                                 $1
          9        SEND_VAL                                                 '%22'
         10        DO_ICALL                                         $2      
         11        SEND_VAR                                                 $2
         12        DO_ICALL                                         $3      
         13      > RETURN                                                   $3
         14*     > RETURN                                                   null

End of function rm_ejs

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.85 ms | 1397 KiB | 20 Q