codeigniter - php Use of undefined constant zip - assumed 'zip' -


sorry i'm new php , i'm getting error when trying use argument function. doing wrong?

public function legislatorsbyzip($zip = null) {     $url = "...";             $params = [         zip => $zip,     ];      $data= $this->curl->simple_get($url, $params);     return $data; } 

error:

a php error encountered

severity: notice

message: use of undefined constant zip - assumed 'zip'

filename: models/congressapi.php

line number: 11

(zip=> $zip line 11 btw) please let me know if need more info..

use "zip" instead of zip , assoc. array should have keys strings or int , words without $ sign constants

$params = [zip => $zip];

change into

$params = ["zip" => $zip];


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -