My String is
$var = 0|var|var1;
i want to save this variable in diffrent variable after | like
$var1 = 0;
$var2 = var;
$var3 = var1;
My String is
$var = 0|var|var1;
i want to save this variable in diffrent variable after | like
$var1 = 0;
$var2 = var;
$var3 = var1;
You can use the explode() function to split the string and then assign it whatever variable you like (or just use the value in the array):
$parts = explode('|', $var);
$var1 = $parts[0];
$var2 = $parts[1];
$var3 = $parts[2];
Documentation is here
There's also a way to get the values straight into variables, without the array.
https://www.php.net/manual/en/function.list.php
list($var1, $var2, $var3) = explode('|', $var);
Or since PHP 7.1 https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.symmetric-array-destructuring
[$var1, $var2, $var3] = explode('|', $var);