• 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 how to get the post thumbnail inside a figure tag

Composer Script echo

CSS file not imported in laravel blade view

Display the WooCommerce product price inside a custom function

JSON Render Issue in Date Object Laravel and PHP 7.4

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

Laravel get user data with profile

Return multiple values from a function using mysqli_fetch_assoc [closed]

How to get the total hour from starting time to end time in php

How to render html from a @foreach loop in a textarea

PHP: Calling MySQL Stored Procedure with Both INPUT AND OUTPUT Parameters (NOT "INOUT")

Laravel 5: Is there a non-case sensitive way to sort a collection by an attribute?

Laravel-fopen: failed to open stream: Permission denied

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

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

About Contact Privacy policy Terms and conditions