• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Extract string between first whitespace and last whitespace in php

php


PHP Snippet 1:

<?php
$str_arr = explode(" ", "Your long sentence here.");
$sub_arr = array_slice($str_arr, 1, count($str_arr)-2);
$extracted_str = implode(' ', $sub_arr);
echo $extracted_str; // long sentence

Related Snippets

get attribute from class not working php 7

Message: Set sys_temp_dir in your php.ini after installed composer

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

Magento 2 - Controller returning blank page

How can I make Laravel return a custom error for a JSON REST API

How to create a individual template for page or post in custom plugin?

is there any way to validate a field that sometime is File(image) && sometime is String(Src of same image)

Ajax GET request fails in laravel 8

Laravel after login Two factor not working

Two buttons one form

How to read laravel_session cookies saved in cookie memory of browser in client side?

Transform array, set each array element with parent key php

Get WooCommerce products from specific category

Laravel whole batch is cancelled if one Job fails

php curl requesting twice

About Contact Privacy policy Terms and conditions