• 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 to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

Laravel Delete and Update

Pass an image through AJAX [duplicate]

Symfony Make:Migration : The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue

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

Custom add to cart button URL for specific product in WooCommerce?

I want a way to give path to my files which are outside of public folder in laravel

Display the default discounted price and percentage on Woocommerce products

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

mysql slow on updates for a well optimized query

browsersync doesn't work with XAMPP

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

get folder directory from input type file - PHP

PHP, how to convert Int value to Week days

About Contact Privacy policy Terms and conditions