joeldg/bowhead

Parse error: syntax error, unexpected '?'

Closed this issue · 1 comments

Hi, i'm tryng to test bowhead, but php give me an error on the CandleMap.php :
Parse error: syntax error, unexpected '?'
bowhead/app/Traits/CandleMap.php line: 200
the code is : in this $ret['continue_bull'] = $ret['continue_bull'] ?? 0;

same error here:
$ret['reverse_bear_total'] = (@$ret['reverse_bear_total'] + $this->price_reversal['bear'][$key] ?? $this->price_reversal['bear'][$key]);

what do they mean "??"

thnaks 1000!

Solved.. depends from PHP version here is coded in php 7
on my pc there is php 5.6

for older versione this is the syntax:

                //$ret['continue_bull'] = $ret['continue_bull'] ?? 0;
                if (!$ret['continue_bull']){
                    $ret['continue_bull'] = 0; 
                 }

                $ret['continue_bull'] = ($this->price_continuation['bull'][$key] > $ret['continue_bull'] ? $this->price_continuation['bull'][$key] : $ret['continue_bull']);
                
                //$ret['continue_bull_total'] =  (@$ret['continue_bull_total'] + $this->price_continuation['bull'][$key] ?? $this->price_continuation['bull'][$key]);
                if($ret['continue_bull_total']){
                    $ret['continue_bull_total'] = ($ret['continue_bull_total'] + $this->price_continuation['bull'][$key]);
                } 
                else{
                    $ret['continue_bull_total'] = $this->price_continuation['bull'][$key];                          
                }  `
```