How to split slash / separated string in two variable in php -


assume applicant id passed other form.i have array variable coming database, here code :

$array_id_applicants = explode(";",stripslashes($applicant_id1)); $applicants_num = count($array_id_applicants); $arr_app_num = array(); for($x=0;$x<=$applicants_num;$x++)  {  if($array_id_applicants[$x]){  $applicant_id = str_replace("'","",$array_id_applicants[$x]);   $applicants = getdata("select cellphone personal applicant_id='".$applicant_id."'"); $replace_array = array("-","(",")","+","_"); array_push($arr_app_num,str_replace($replace_array,"",$applicants[1][cellphone]));  } } $applicant_number = implode(";",$arr_app_num); echo $applicant_number; exit; 

assume value of array :

$applicant_number = '639152478931 / 631687515455','631235497891' 

i want output :

$applicant_number = '639152478931','631687515455','631235497891' 

  <?php     $applicant_number[] = '639152478931'; $applicant_number[] = '631235497891'; $applicant_number[] = '1111111110294765388389'; $applicant_number[] = '0012324252728'; $new    =   array(); foreach($applicant_number $number) {                        $count = strlen($number) - 10;                           $b = substr($number,$count);                      $new[]  = "+63".$b;             }    print_r($new);                 ?>    

gives :

array ( [0] => +639152478931 [1] => +631235497891 [2] => +634765388389 [3] => +632324252728 )


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -