• 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

WordPress Subquery returns more than 1 row on SELECT

How to get the survey List from surveygizmo API in the Postman?(Trial Version)

Assets not referencing to public folder (Laravel)

woocommerce_wp_select options array from product attribute terms

Component install error: JInstaller: :Install: File does not exist

How to pass data to all views in Laravel 5?

Image upload not working through ajax Laravel

wp_remote_get() not passing authentication

How Can I Do LIMIT 1, 2 In WP_Query

I'm trying to use curl with php but getting this error:Could not resolve host: Bearer

How do I enable error reporting in Laravel?

Can't call javascript alert alertify library from PHP

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

Getting error: CodeIgniterDatabaseBaseResult::getResult in CodeIgniter

IlluminateDatabaseQueryException: SQLSTATE[HY000]: General error: 1 no such table - In clone project

About Contact Privacy policy Terms and conditions