I would like to use a regular expression to validate user input. I want to allow any combination of letters, numbers, spaces, commas, apostrophes, periods, exclamation marks, and question marks, but I also want to limit the input to 4000 characters. I have come up with the following regular expression to achi…
Tag: php
upload_max_filesize doesn’t change within Laravel 5.1
I’m working on multiple file upload while that time I’ve got an error The file “theOne.mp3” exceeds your upload_max_filesize ini directive (limit is 2048 KiB). So after that I’ve increased the …
Preg_match string inside curly braces tags
I’d like to grab a string between tags. My tags will be with curly braces. So far I have found #<s*?$tagnameb[^>]*>(.*?)</$tagnameb[^>]*>#s This one matches tags with angle brackets <>. I couldn’t figure out how to make it look for curly braces. Eventually I would like to p…
PHP uninclude or reinclude file in interactive mode
I’m testing some database related functions in interactive mode. The first thing I did is to include the testing file, let’s say database.php Then I can make change to the database by a function call. The question is, when I make any changes to database.php, I have exit PHP interactive mode, re-en…
Copy to clipboard from php command line script in Windows 7
I have a php (5.5) script which I run from the command line in Windows 7. Something like this: My question is, is it possible to copy something to windows clipboard from the script? I want users to have some text available in the clipboard after running this script from the command line. How can it be done? A…
Outline a transparent image using imagick PHP
I have an image with a transparent background that I’d like to outline with a 5px border. In photoshop, I can stroke it to achieve this. I’ve tried using borderImage but it won’t outline the penguin. …
Can’t move composer
When I install composer on my mac with: curl -sS https://getcomposer.org/installer | php And then try to move it like this: sudo mv php composer.phar /usr/local/bin/composer it’s telling me: …
Object of class IlluminateDatabaseEloquentBuilder could not be converted to string in laravel 5.1
I have been trying to debug a problem for the past two days, my code, as follows, is first attempting to retrieve the category by it’s id: $term = category::get([‘id’]); Then using this retrieved …
Extract email address from string – php
I want to extract email address from a string, for example: From the above string I only want to get email address ruchika@example.com. Kindly, recommend how to achieve this. Answer Try this see demo here Second method See demo here
Access denied for user ‘root’@’localhost’ (using password: YES) after resetting root password
I am getting this when trying to load a webpage that requires the mysql database. I had to go and recently reset the root password that was used for phpmyadmin. oops connection problem ! –> Access denied for user ‘root’@’localhost’ (using password: YES) All this is also runnin…