I am working on a small project on my local machine (in a nginx docker container) and I today was the first time when I uploaded it to my webserver and found out that it’s an apache server. Everything works fine, except for my router.php. When I visit example.com/admin I get an error 404 on my apache se…
Tag: php
preg_replace phone number sanitizing for international numbers
I have a snip of PHP code that we use to strip out spaces and non numericals from phone numbers in PHP which works great and it removes the leading 0 from the phone number as well: However in some scenarios the leading number is not a 0 it will be a 1 and we don’t want them stripped. so
How to make a single endpoint operation public in API Platform?
In API Platform, I have all the endpoints secured with JWT but I would like to have the POST User public so users can register themselves. How can I do this at entity level? if I implement this in security.yaml as usual in Symfony it works I just would like to know if I can do it at entity level
ob_get_status() has undocumented bits set in ‘flags’ entry
I’m having an issue with an output buffer not being called at the end of my PHP application. If I call get_ob_status(true) just before my script ends, I get the following output: The outer buffer looks broadly as I would expect, but there are two things that are odd about the inner buffer: It is empty (…
SQL to .csv – How to Get Rid of Double Array Entries
I’m using php code to get the values from a database table with 3 columns and put them into a .csv file The problem is that I’m always getting double entries of every column. Here is the first row that shows the problem. The array should be 3 items but it is 6. Here is how I’m getting the ab…
Laravel Blade Component – UTF-8 Encoding issue
I’m currently working on an application with Laravel 8 version. I have build a component named input-group which cause encoding issues that i don’t understand. The code of the component look like this : Here is the data that I inject into the value attributes => Inspecteur de l’Education …
Warning: Undefined array key in php for unknown reason
Hello everyone I was practicing php arrays and my editor cannot detect an error I have with my php however when it runs I get the error message Warning: Undefined array key 3 in php while still printing the output correctly. my html form is: my php form is: and the php program file to run it all is: After
How to prevent “my own” javascript code to open a new window?
This one is hard… I have this task to build a module for a big system made with PHP. The most important rule is that I can’t touch the code of the core system, so I can’t fix some of it’s bugs. The main service of my module is to create a custom document that is not edited by the
require footer and header each page but error 500
Hi, I start in PHP and I create my website. I create a component of header and footer to print on each page with : require ‘/assets/components/header.php’; and require ‘/assets/components/footer.php’; So, the problem is that on localhost, it works, but on website, it didn’t work …
Change which a-tag is highlighted depending on active page
So I have a menu with different items The class=”active” highlights the menu item, and I was wondering how I could make this class change depending on which page I was on. So if the user visited Archives, then that has class=”active”. The class is just a simple color All my html code i…