I have a function which is working fine to create zip file from folder files. But recently I’ve had need to add sub-folders into my main folder and now I see my function does not add those sub-folders and files in them into generated zip file. here is what I have currently: By using code above, let say I have
Tag: php
Regex To Capture Alpha-Numeric and Ignore Patterns (like Interpolation) and Symbols
I have a string that could contain letters, numbers, special characters, or a pattern (such as */my-variable/*). I want to basically ignore the special characters and any patterns (could be multiple), and take the remaining text to ensure it’s usable text. My goal is to look at this string and mark it as valid or not, so long as it
IlluminateAuthSessionGuard::login(): Argument #1 ($user) must be of type IlluminateContractsAuthAuthenticatable, null given, called in … line56
I am using fortify for creating and logging-in users. So as I add a new column ‘role’ in my database as well as in the model. I face this kind of error when signing-up a new user. Somehow, the user information will still be registered and stored in the database but an error is shown as I click Register. How
How to upload files from react native app to PHP server?
I developed a PHP project, now I am working on connecting it to react native app. However, I tried many codes to upload image to the server nothing works. Here is my code example, }; And for the PHP server side (upload.php), here is the code I got this code from here https://aboutreact.com/file-uploading-in-react-native/ And I am getting this error Can
errors messages with html and php
i have this code bellow: it doesn’t show any error when the email is not correct or the password is less than 6, and inserts data normally, I need to show for example two error messages if both password and email are not correct, how can I do it? Answer Amend your code so that it will NOT execute the
How foreach loop work to sum value of same key in associative array
I have associative array.Operation of the below code is that it will sum all the array index’s value which key is similar, but i did not understand how it operated. i have problem in two portion of above code one is: if ( !isset($sums[$key]) ) { $sums[$key] = 0; } another is: $sums[$key] = ( $sums[$key] + $val ); In
The most efficient way to do eagerload in Laravel Policy for yajra-datatable use
I need to eager load relationship within laravel policy The problem is i use the laravel policy inside yajra-datatable which will load it (the policies) line by line Here’s the code looks like : and i use it in my yajra-datatable like so : so every line will load the relation again and again I’m expecting more efficient way to
How to sum php array that have same key but different sensitivity
I want to sum the value of keys that are the same but in diffrent case. Let’s say we have this array Answer Loop through the keys and values. Convert each key to uppercase. In a 2nd array, set the key/value to the sum of the current value in that array (or 0 if it doesn’t exist) plus the value
Split a comma delimited string into an array and display on html page
basically I’m making a page where the information from mySQL database will be displayed. I have a column named topics in the database where the string (VARCHAR) goes like this: Marketing, Business, Law, Medicine, … I’m trying to break up this string after a comma and display them in a single line one by one like this: I already have
PHP Pagination from Huge JSON array_chunk in to multiple files and getting offset
So I have this huge file that has 45K+ arrays and I can’t just open a huge file on live server with high traffic from every request so I used array_chunk($array, 1000) and saved them in 46 files. Now I want to read those files when specific page is accessed. Problem? $offset seems to be working fine with some pages