hello all my name is rico,
i want make some app like can combine number from input
example :
i have 4 variable like this
$num1 = 96;
$num2 = 20;
$num3 = 19;
$num4 = 37;

so how can i get the result like this
9213 9217 9293 9297 .. etc.

and example 2 if $num is empty then the result is like this
213 217 293 .. etc.

note : space in number is for star i can't write start in simbol in there

I can't see how any combination of the variables given results in 9213 or such. Maybe your examples were incorrect?

commented: must take 1 by 1 number from variable example like this $num1 = 9; $num2 = 2; $num3 = 1; $num4 = 3; and combine $num1.$num2.$num3.$num4 = 9213 and etc +0

Thanks for the comment. That makes me think you need to use the following function to convert numerics to strings.

Read https://www.php.net/manual/en/function.strval.php

commented: PHP is an untyped language. You can just use substr() on the number with no need to convert it to a string. -8
commented: thanks bro i already found the result where i want +0

Thanks for the comment. That makes me think you need to use the following function to convert numerics to strings.

PHP is an untyped language. There's no need to type cast it to a string. Use the PHP substr() function to get the digit you want (first, last, middle.)

commented: Hmm, my reading was they were making a string, not extracting. +15
commented: where i can reply my post? i want reply for the answer +0

solved the answer :

$num1 = 96;
$num2 = 20;
$num3 = 19;
$num4 = 37;

$data = [];

for ($i = 0; $i < count($num1); $i++) {
    for ($i1 = 0; $i1 < count($num2); $i1++) {
        for ($i2 = 0; $i2 < count($num3); $i2++) {
            for ($i3 = 0; $i3 < count($num4); $i3++) {
                $num = $num1[$i].$num2[$i1].$num3[$i2].$num4[$i3];
                array_push($data, $num);
            }
        }
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.