• 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

PHP mail sending empty mails

How to loop sql table data inside a html table

calling server using nusoap with complextype

Why rand() every time I refresh the page?

Make survey at laravel 5.4 and MySQL

In PHP, which is faster: preg_split or explode?

PHP random string generator

Doctrine 2 mapping referencing unique key

PHP Warning: Module already loaded in Unknown on line 0

Attempted to call an undefined method named "get" of class "MailController"

How to show selected value using javascript in laravel

Laravel with App Engine Standard Class 'FacadeIgnitionIgnitionServiceProvider' not found

Jquery DataTables: Data not displaying in table via Ajax

error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

Add 2 Webcam in one page with WebcamJS

About Contact Privacy policy Terms and conditions