Skip to content

Tag: php

How to pass arguments to anonymous PHP class constructor?

I wrote small anonymous class. now i want to pass some arguments to anonymous class . how could i accomplish this task . Currently i m using PHP 8.1 version Answer Because your class require $num argument in construct, you need to pass it when you instanciate your object. Will result

Php, fill hours missing in array [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 months ago. Improve this question I have an array composed by starting hour and finish hour. Like: What i n…

HEROKU error: During inheritance of ArrayAccess

This is the log of heroku, previous version of my code was running perfect but I change some code and have this error. Rollback is no t solution same error now… Answer I got the exact same error recently. My local php version is 8.0.13 and it is working fine, but when I uploaded it to heroku (the php ve…

Use a request header with HTTP Client to external Api server

Consider the following request to a Symfony controller: This code snippet is a minimal example for the usage in a controller. The controller accepts a Request, and uses the x-token header for authenticating against the 3rd Party Api (here: localhost:3001). Is there a way, to automate this process? So basicall…

How can I find the middle of a HERE Routing API route?

by doing a GET-Request, I am receiving routing informations from the HERE Routing API: https://router.hereapi.com/v8/routes?apikey=MY_API_KEY&destination=52.530394,13.400683&origin=52.530728,13.383833&return=polyline,travelSummary&transportMode=truck&&vehicle[speedCap]=30&spans=nam…

add field and value to array while looping through?

I have the folowing 2 arrays, and I need to add the value of the first one depending on the ID value of the second one as Key so I can order the 2nd array DESC: $views: And I have the folowing array object: $most_seen_list : with the next foreach Im going through it and I want to change the