• 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 send parameters in soap request in php in __soapcall() function

Two buttons one form

How to display table header in every page using FPDF library?

sqlsrv_num_rows() expects parameter 1 to be resource, boolean given

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

How can I make good efficent AJAX live forms with just jQuery and

How can I format this number correctly using PHP?

PHP, how to convert Int value to Week days

Laravel unique validation on multiple columns

get attribute from class not working php 7

Handle error for duplicate entries - PHP/MySQL

Submitting a form with ajax in Wordpress

how to remove %20 in the url in php

How to install PHP composer inside a docker container

how to loop through json response data using ajax jquery?

About Contact Privacy policy Terms and conditions