• 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

Clear javascript source cache laravel 5.8

Get number of working days between two dates in PHP [duplicate]

How to prevent phpmailer sending embedded image as an attachment on Gmail?

How to add a sidebar to Woocommerce Shop Page?

How to get multiple values with same key from an array PHP

How to show a popup modal in codeIgniter?

sqlsrv_num_rows() expects parameter 1 to be resource, boolean given

Assign output of PHP function to a variable

PhP how to calculate moments with variables rows

Laravel database insert with combining array and string

How avoid Moved Permanently The document has moved here

Laravel Passport - Not able to get token string in response?

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

How to add a heading in between checkout fields of WooCommerce

Show only featured products in Woocommerce shop page

About Contact Privacy policy Terms and conditions