• 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

How do I call a php file with axios?

Symfony process run throws exception - executing on command line works

Accessors (Getter) & Mutators (Setter) On a Pivot Table in Laravel

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

Laravel Multi-language routes without prefix

How to get the ID of the link in another page in php

PHPUnit gives error: Target [IlluminateContractsViewFactory] is not instantiable

How to get Laravel's CSRF Token from Another Website?

Modify microseconds of a PHP DateTime object

Laravel 5.1 Unknown database type enum requested

Popup Window and PHP form

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

Manage independently the decimal number of the price of each product [duplicate]

Transform array, set each array element with parent key php

Star rating with half star support

About Contact Privacy policy Terms and conditions