• 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

get attribute from class not working php 7

how to prevent float variables displaying as scientific notation when printing [duplicate]

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

httpd.conf on Windows: can't locate API model structure `php8_module`

insert multiple rows in a saveall in cakephp

How to KeyBy where multiple items have the same key

Invalid value in field "itemtype" in Google Search Console

How to send image,audio or video through the WhatsApp API - PHP

Form Validation and Submission to database

Filter WooCommerce related products by Polylang language

Insert a DIV after the 6th product only once in WooCommerce category archives

Select option menu read from database and use it's values

Can't exclude directories from .htaccess mobile redirect?

google content api for shopping

How to retrieve Active Directory group policy maximum password age using LDAP

About Contact Privacy policy Terms and conditions