How can I replace chars like ???????? from a string? Sometime the YouTube video title contains characters like this. I don’t want to replace characters like !@#$%^&*(). I am currently using …
convert large data in json format
i have a table named mobile in which all the mobile data is contained which have more then 7000 records now i want to display in json format but some how records are not showing here is my code kindly check .. table Answer The problem with JSON_ENCODE in PHP is, it tends to add double quotes and escaping sequ…
How to validate an input field if value is not null in Laravel
I am trying to create and update users with laravel 5.4 This is the validation added for create user. It works. On update the password field is not required. But validate the min:6 and confirmed rule if the password field is not null. Tried with sometimes.. but not working.. Answer try using nullable as a rul…
How to test validation errors throw exact error and message in laravel unit tests
How to test specific validation errors in php unit thrown in validation error ? with below code we could check session has errors, but not the exact error $this->assertSessionHasErrors();
Accessing Laravel .env variables in blade
I am trying to get some API keys which I have stored in my .env file to use in the blade javascript. I have added two keys like: In blade I need to use the Google Maps API and OverheidIO API key. I have tried getting one of the default .env variables just in case I have formatted the custom
Regex for 24 hour time
I have found a working expression for accepting only 24 hour time, but my problem is it will accept things before and after such as characters awf23:59fawf 23:59gfes 123:59 Are all accepted, I want to stop allowing this and only accept HH:MM within my statement: if (preg_match_all(“~((2[0-3]|[01][1-9]|1…
PHP MySQL Error echo insert into values printing on screen
I am learning PHP MYSql and faced an error while writing a marks submission program. When i run the program in chrome, the table is coming ok but neither the values are inserting in the MySQL table nor the redirection to different webpage taking place. You will understand it more clearly in the code and scree…
Use array_merge_recursive for unknown number of arrays
I have a PHP script where I get a random number of arrays nested inside an array and need to merge them using array_merge_recursive. Given the number of nested arrays is always variable, is there a …
PHP7.1 json_encode() Float Issue
This isn’t a question as it is more of a be aware. I updated an application that uses json_encode() to PHP7.1.1 and I was seeing an issue with floats being changed to sometimes extend out 17 digits. …
preventing abuse of API service usage
I am planning on using Laravel in my next web project, for the backend. Using the Laravel’s built-in functionality I will build an API service. So my main concern now – is about the security of such service. Laravel’s API throttling middleware seems to be an easy to use solution, but it does…