Error trying to pass regex match to function

后端 未结 5 1624
生来不讨喜
生来不讨喜 2021-01-19 13:03

I\'m getting Syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or \'$\'

This is the code i\'m using

function wpse44503_filter_con         


        
5条回答
  •  鱼传尺愫
    2021-01-19 13:55

    if PHP variable begins with number use following:

    when I was getting the following as the result set from thrid party API

    Code Works

    $stockInfo->original->data[0]->close_yesterday
    

    Code Failed

    $stockInfo->original->data[0]->52_week_low
    

    Solution

    $stockInfo->original->data[0]->{'52_week_high'}
    

提交回复
热议问题