20 T_CONSTANT_ENCAPSED_STRING =>
true,
25 T_DOC_COMMENT =>
true,
27 $tokens = token_get_all( $string );
29 for ( $i = 0; $i < $count; ) {
30 while ( isset( $skipTypes[
$tokens[$i][0]] ) ) {
39 $varname = trim( substr(
$tokens[$i][1], 1 ) );
42 while ( isset( $skipTypes[
$tokens[++$i][0]] ) ) {
46 while ( isset( $skipTypes[
$tokens[++$i][0]] ) ) {
49 if ( isset( $scalarTypes[
$tokens[$i][0]] ) ) {
54 while ( isset( $skipTypes[
$tokens[++$i][0]] ) ) {
60 while ( isset( $skipTypes[
$tokens[++$i][0]] ) ) {
67 while ( isset( $skipTypes[
$tokens[++$i][0]] ) ) {
70 if ( isset( $scalarTypes[
$tokens[$i][0]] ) ) {
72 } elseif (
$tokens[$i][0] === T_ARRAY ) {
73 while ( isset( $skipTypes[
$tokens[++$i][0]] ) ) {
80 while ( isset( $skipTypes[
$tokens[++$i][0]] ) ) {
86 if ( isset( $scalarTypes[
$tokens[$i][0]] ) ) {
89 while ( isset( $skipTypes[
$tokens[++$i][0]] ) ) {
92 if (
$tokens[$i][0] !== T_DOUBLE_ARROW ) {
95 while ( isset( $skipTypes[
$tokens[++$i][0]] ) ) {
98 if ( isset( $scalarTypes[
$tokens[$i][0]] ) ) {
102 $buildval[$key] = $val;
104 while ( isset( $skipTypes[
$tokens[++$i][0]] ) ) {
109 } elseif (
$tokens[$i] ===
')' ) {
118 if ( is_null( $varindex ) ) {
119 $this->vars[$varname] = $buildval;
122 $this->vars[$varname][$varindex] = $buildval;
125 while ( isset( $skipTypes[
$tokens[++$i][0]] ) ) {
133 throw $this->
except(
$tokens[$i],
'open tag, whitespace, or variable.' );
161 if ( is_array( $token ) ) {
166 if ( $str !==
'' && $str[0] ==
'\'' ) {
171 return strtr( substr( trim( $str ), 1, -1 ),
172 [
'\\\'' =>
'\'',
'\\\\' =>
'\\' ] );
176 if ( $str !==
'' && $str[0] ==
'"' ) {
182 return stripcslashes( substr( trim( $str ), 1, -1 ) );
186 if ( substr( $str, 0, 4 ) ===
'true' ) {
190 if ( substr( $str, 0, 5 ) ===
'false' ) {
194 if ( substr( $str, 0, 4 ) ===
'null' ) {