• 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 can I get data from PHP to Android TextView?

How to get values inside <![CDATA[values]] > using php DOM?

Pagekite error: FAIL: localhost:8080 is down

How to create laravel storage symbolic link for production or sub domain system?

php curl requesting twice

Laravel 4 Redirect::back() not going to previous page (refreshing current page)

phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO)

Split comma separated value from table column into rows using mysql?

how to remove white space in select 2

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

Laravel/ PHP: Order By Alphabetical with numbers in order [duplicate]

file_get_contents() without "Http" to access external URL [closed]

Redis Command To Sort Keys

How to get monthly wise data in laravel

Not able to access model in the controller mautic

About Contact Privacy policy Terms and conditions