• 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 web3 ERC20 token function call

Download & Save Zoom Recording in directory by PHP

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

VichUploaderBundle error "Expected argument of type "File", "NULL" given" when submitting the form without selecting any file

how to insert data into select2 search input after scan using qrcode

PHP/HTML: Creating A SubMenu

How to convert a carbon into string, to take the date only?

How do I call a php file with axios?

Adding custom body class to the custom archive pages

Get sql.h error on MacOS 12 (Monterey) sqsrv and pdo_sqsrv drive installation

WHM Enabling mod_rewrite

Laravel: Why is my variable not being set while it's in the construct function of the controller?

Undefined Array Key error when uploading image on php

How do I call Validator from a namespace with an already existing Validator class

PHP Discord OAUTH2 code sample not working

About Contact Privacy policy Terms and conditions