arrays - How to use explode and get first element in one line in PHP? -


  $ first dot = explosion (".", $ String) [0];   

This is what I am trying to do, except that this syntax gives error if there is a workaround for a liner, please let me know if this is not possible , Please explain.

It was implemented in PHP 5.4, so if you are using an older version, Will have to do in another way.

An easy way to do this is:

  $ beforeDot = array_shift (explosion ('.', $ String));    

Comments

Popular posts from this blog

How can I add a seperate action listener to all 14 of my buttons at once that can determine player turn?(java) -

php - Sorting an multidimension array using usort fails -

Simple file compression in C -