• 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 to prevent float variables displaying as scientific notation when printing [duplicate]

Laravel Command Schedule Not Working Properly

How to get page number on dompdf PDF when using "view"

Make survey at laravel 5.4 and MySQL

What will the best solution for this multiple optional filter?

browsersync doesn't work with XAMPP

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

Get WooCommerce product variation attribute terms in admin products general box

Reload parent page after submit in iframe

Adding custom body class to the custom archive pages

ORA-12546: TNS:permission denied error connection to remote oracle server

How can I stop a symfony process which is listening on http://127.0.0.1:8000

PHP and WebView - Cookie doesn't are the same

PHPExcel_IOFactory::createWriter causes wrong behaviour

Laravel Delete and Update

About Contact Privacy policy Terms and conditions