Skip to content

PHP looping over data and getting key/value pairs

I’m using Laravel 8 to loop over some data. I’ve got my data out from my database, but am struggling to loop over the data in a foreach loop, it doesn’t appear to be giving me the key/value pairs, only the index/value pair? But if I var_dump() my $applicationOptions I can see the array insid…

How to put a MySQL table column as a variable in ?

I recently made a PHP, HTML, jQuery chat system and I want the users to have the same name in chat, as their login. The whole webpage is already connected to the MySQL database. I want to focus on how …

PHP Query – Check string character

Above code is working where it able to check if the “variable” is starting with ‘ax’, but what if i wanted to check “multiple” different validation ? for example : ‘ax’,’ab’,’ac’ ? Without creating multiple if statement Answer You can use…

Customize URL rewriting with htaccess

I have the following in my htaccess: It works perfectly, the question is whether it would also be possible to automatically redirect it to the new path when the PHP file is accessed directly? For example: example.com/pwreset.php >> example.com/reset-password There are several pages, so I needed somethin…

Why we have used except(‘logout’)? [closed]

In one of the training tutorials , I saw this code in LoginController but I don’t understand why except(‘logout’) is used. Could you please explain it to a beginner? What does except(‘logout’) mean? …