Skip to content

Tag: arrays

Laravel casts with relation

I’m making a survey website where users provide answers from 0 to 10. I was experimenting with the casts to store all questions and the answer in 1 row. This is what the scores field looks like in the database This is as expected. The “5” and “6” are ID’s of the question an…

Call to a member function save() on array laravel

Im doing the update method. When I tried to update the specific data, im getting this error “Call to a member function save() on array”. Why? Is there’s something missing in my codes? I also tried to print_r the $result variable, it has a value.. View Controller Route Answer This way can hel…

How can I create Associative array in Swift 3

Hi I am very new to Swift and am trying to use array. I want to create an array in swift3 similar to this PHP array as below: In the array above the country name are dynamic variables. Answer These are called dictionaries in Swift, and you can create one like this: EDIT: Swift is great at inferring the variab…

JSON_ENCODE can’t encode large array

I need help with encoding large array into JSON using PHP’s json_encode(). The array is from a local Database. I am using JS to parse JSON. However, the PHP script that handles array to JSON format stops if the dataset is too big. (i.e 100,000 Results). I tried to up my memory_limit to -1 and still does…