How to seperate data in one variable php -


i have data store in 1 varible, how separate this:

$data="john doe 25yr london" 

become this:

$name="john doe"; $age="25"; $city="london"; 

<?php  $data="john doe 25yr london";  $arr = preg_split('/(?=\d)/', $data, 2);  if(count($arr) == 2) {     $name = trim($arr[0]);     $city = trim(strstr($arr[1], ' '));     $age = trim(str_replace($city, '', $arr[1])); } 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -