JSON Unicode

Good afternoon!
There is a simple function:

public function pages($category=0,$min=0,$max=10)
    {
        $this->db->select('id,title,showed');
        $this->db->where('category',$category);
        $this->db->where('post_status','publish');
        if($min>0) {
            $this->db->limit($min,$max);
        } else {
            $this->db->limit($max);
        }
        $query = $this->db->from('content')->get()->result_array();
        foreach($query as $val){
            $query = $this->load->module('cfcm')->connect_fields($val,'page');
        }
        return json_encode($query,JSON_UNESCAPED_UNICODE);
    }

But for some reason the second parameter in the json_encode function causes a problem:

A PHP Error was encountered

Severity: Warning

Message: json_encode() expects exactly
1 parameter, 2 given

Filename: get/get.php

Line Number: 52

There is a parameter in the documentation, what’s wrong?


Answer 1, authority 100%

if php is lower than 5.4.0 then the error is understandable, update your php to 5.4.0 this is the only solution to the problem

Version Description
5.4.0   JSON_UNESCAPED_UNICODE options were added.