I wanted to make a small function that let’s me connect to the database, do something in a callback function and then automatically close the connection like so: Usage would be like this: Is it possible to achieve this somehow? Because my mysqli_conn doesn’t seem to work. How to do it? Answer Supp…
Tag: php
Get dependencies Ids Algorithm
I have this problem and I came out with a solution but what is the best way to solve this problem ? Thank you in advance. Given an array of strings and an array of tasks you need to return a sorted array with tasks and dependencies tasks ids. Example: Expected output: So far this is the solution I built,
PHP | Make a validation check whether the number has a decimal point == x.00 or not
Em, I don’t know how to explain this. I hope you’ll get the point. I’ve variables: From those variables, I want to make a statement as follows: Did you get it? What I want is that when the decimal point of $c is x.00 (like 25.00, 10.00, etc), the $c will be printed. But if the decimal point …
Using an array as request headers in PHP
I’m trying to send a GET request to an API using PHP stream_context_create and file_get_contents. I need to add API keys to the headers of my request, I’m storing these in an array so I easily edit them later and use them in multiple functions. What is a good way to include these arrays as headers…
Can I use the same table to represent different Entities in Symfony?
I am migrating an old PHP project to Symfony. I am trying to create the entities based on the existing database schema which I can not change. I am facing a problem : There is a table that would represent two different entities. Basically, there is a boolean (a tinyint(1)), if the boolean is false, then the r…
Is there a way to dynamically switch default dashboards in Nova
What I am looking for: A way to potentially load a appNovaDashboardsDashboardExample as the default dashboard. Problem Nova comes with a default dashboard which is build in the NovaServiceProvider and gives you the possibility to add additional dashboards using the dashboards() function. When using this dashb…
Is it bad practice to customize existing Plugins in WordPress? [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year. Improve this question I currently have a client that wants a lot of custom work at a fairly b…
Twilio Conversation Fatal error when trying to send message?
I am trying to do a group conversation following the twilio samples online. I have the conversation and the people are connected (I think) but when I go send a message I get the following error: Does anyone have any working samples of a working conversation in PHP? If you want I can post my full code (minus t…
PHP I want to restrict a button in the navbar to Admin users only
Currently making a blog websit and wanted to add an administrator locked button in the navbar that allows them to delete users there is onlly 1 Admin whos username will be “Admin”. Right now I have something like this: I keep getting this error Fatal error: Cannot use isset() on the result of an e…
undefined index when page is loaded
I’m having a issue where a variable is becoming undefined when the page is loaded individually… So. My front page has a address form where when the address is filled out and you click “Get your offer” it’ll take you to another page where the address is carried over using $_POST[&…