• 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

Download & Save Zoom Recording in directory by PHP

How do I call Validator from a namespace with an already existing Validator class

Call to undefined function openssl_decrypt

php mysql + create a friend request system

Shopify password update using Shopify API

(PHPUnit) PHP Fatal error: Uncaught Error: Call to undefined function each()

Laravel query builder binding parameters more than once

SQL AVG() to 2 decimals

using random function but it's displaying duplicates

Google API Heatmap Layer exception, why?

How can I pass the list to the component variable in Laravel?

How to use a PHP MVC Controller, one thats invoked by calling a URL, to call and execute more than one function? [duplicate]

php file upload scanning using clamav, permissions on /tmp/

cakephp save drag and drop list order to database

jQuery Ajax Post with data

About Contact Privacy policy Terms and conditions