• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

break multiple variables within one variable

I have a 3 variables sent through a single post variable which I nned to break up

eg: posted value: [4546-B9487521-8] or like [6040-589A7S8-12] as you could see the 3 variables are separated by hyphens and the variables do not have the same length all the time

then name the value after it was broken
var1 = 4546
var2 = B9487521
var3 = 8
0
bdipasquale
Asked:
bdipasquale
  • 2
1 Solution
 
steelseth12Commented:
$temp = explode("-",$_POST["var_name"]);
      
      $var1 = $temp[0];
      $var2 = $temp[1];
      $var3 = $temp[2];
0
 
steelseth12Commented:
You might want to look at

 http://www.php.net/manual/en/function.explode.php

for more information on the explode() function.
0
 
x_bakosCommented:
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now