• 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

How update php.ini on a Mac OS X Mojave?

Mysqli multi query error

How to add a custom field to all Woocommerce attribute terms using add_action

backup files to google drive using PHP

How to run a shell as root from php (apache)

How to use a PHP MVC Controller, one thats invoked by calling a URL, to call and execute more than one function? [duplicate]

Limit WooCommerce products in cart only from one custom taxonomy

How can I remove the "Advanced" panel of all blocks in WordPress block editor?

How to test laravel controller method?

Laravel Delete and Update

How to run or debug php on Visual Studio Code (VSCode)

Remove product downloads section in woocommerce email notifications

Get number of working days between two dates in PHP [duplicate]

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

Unable to uninstall brew php from homebrew

About Contact Privacy policy Terms and conditions