1550099586
I'm trying to split a simple string by multiple delimiters, but get an unexpected result.
Consider the following string: "1_10_10-Einzel.pdf"
Using this call to preg_split:
$cut = preg_split("/[_\-\.]/", "1_10_10-Einzel.pdf", PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE); print_r($cut);
I expect the following output:
Array ( [0] => 1 [1] => 10 [2] => 10 [3] => Einzel [4] => pdf )
, but actually what I get is this:
Array ( [0] => 1 [1] => 10 [2] => 10-Einzel.pdf )
I played around a little bit with parentheses, flags and of course different regexes, but I don't get the expected behaviour. I also tried some completely different examples from stackOverflow, but also got a wrong result. Do I miss something?
#php #regex
1550108021
Parameter 3 is the limit, 4 is for flags. Try:
$cut = preg_split("/[_.-]/", "1_10_10-Einzel.pdf", -1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE);
print_r($cut);
.
doesn’t need to be escaped in a character class. The -
also doesn’t if first or last.
1597559012
in this post, i will show you easy steps for multiple file upload in laravel 7, 6.
As well as how to validate file type, size before uploading to database in laravel.
You can easily upload multiple file with validation in laravel application using the following steps:
https://www.tutsmake.com/laravel-6-multiple-file-upload-with-validation-example/
#laravel multiple file upload validation #multiple file upload in laravel 7 #multiple file upload in laravel 6 #upload multiple files laravel 7 #upload multiple files in laravel 6 #upload multiple files php laravel
1597470037
Here, i will show you how to upload multiple image with preview using ajax in laravel.
Just follow the below steps and upload multiple images using ajax with showing preview in laravel applications:
https://www.tutsmake.com/laravel-7-6-ajax-multiple-image-upload-with-preview-e-g/
#laravel multiple image upload with preview #laravel multiple image validation #display multiple images in laravel #laravel multiple file upload #multiple image upload in laravel 6 #ajax image upload and preview with laravel
1595201363
First thing, we will need a table and i am creating products table for this example. So run the following query to create table.
CREATE TABLE `products` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
Next, we will need to insert some dummy records in this table that will be deleted.
INSERT INTO `products` (`name`, `description`) VALUES
('Test product 1', 'Product description example1'),
('Test product 2', 'Product description example2'),
('Test product 3', 'Product description example3'),
('Test product 4', 'Product description example4'),
('Test product 5', 'Product description example5');
Now we are redy to create a model corresponding to this products table. Here we will create Product model. So let’s create a model file Product.php file under app directory and put the code below.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
protected $fillable = [
'name','description'
];
}
Now, in this second step we will create some routes to handle the request for this example. So opeen routes/web.php file and copy the routes as given below.
routes/web.php
Route::get('product', 'ProductController@index');
Route::delete('product/{id}', ['as'=>'product.destroy','uses'=>'ProductController@destroy']);
Route::delete('delete-multiple-product', ['as'=>'product.multiple-delete','uses'=>'ProductController@deleteMultiple']);
#laravel #delete multiple rows in laravel using ajax #laravel ajax delete #laravel ajax multiple checkbox delete #laravel delete multiple rows #laravel delete records using ajax #laravel multiple checkbox delete rows #laravel multiple delete
1597559901
Here, i will share with you how to multiple image upload in laravel 7, 6 using ajax. And display preview of multiple images before upload in laravel.
Upload multiple images using ajax with preview in laravel 7/6 by following the below steps:
https://www.tutsmake.com/laravel-7-6-ajax-multiple-image-upload-with-preview-e-g/
#ajax multiple image upload and preview with laravel #multiple image upload in laravel 6 #laravel multiple image upload with preview #upload multiple images ajax jquery laravel #laravel multiple image validation
1597499549
In this post, i will show you, how you can upload multiple file with progress bar in laravel using jQuery ajax.
So follow below given steps to create ajax multiple image upload with progress bar with jquery and laravel php.
Now follow the below given simple and easy step to upload multiple file with progress bar in laravel using jQuery ajax:
https://www.tutsmake.com/laravel-7-multiple-file-upload-with-progress-bar/
#multiple file upload with progress bar using jquery and laravel #laravel multiple file upload ajax with progress bar #how to upload multiple images with progress bar in laravel #laravel 7 multiple image upload example #image upload with progress bar laravel #laravel multiple image upload ajax