• 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

Sentry + Laravel: how to log an already catched Exception?

PHP Include for HTML?

Apply session id from request header

Install mysql client in docker image

if statement inside concatenation

Destroy session upon refresh

Post Form Data To phpmyadmin Database

IlluminateDatabaseQueryException could not find driver [duplicate]

How to fix 'Data has already been sent to output, unable to output PDF file' in MPDF

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

HTTP Range requests with php for Video Embedding for solving going to specific time in video (seek bar not work)

Check If array is null or not in php

Laravel UUID generation

GRPC installed successfully on ubuntu but php is looking for it in another folder

generate an Excel file using PHP

About Contact Privacy policy Terms and conditions