<?php
$value1 = $value2 = 0;
$searches = array(
"Bredd:",
"bredd:",
"Bredd=",
"bredd=",
"Bredd ",
"bredd ",
"Höjd:",
"höjd:",
"Höjd=",
"höjd=",
"Höjd ",
"höjd ",
);
$tests = array(
"Höjd=25,bredd=35",
"Höjd=100,bredd=81",
"Höjd = 25,bredd = 35",
"Höjd:25,bredd:35",
"Höjd: 25,bredd: 35",
"Höjd : 25,bredd : 35"
);
foreach( $tests as $test)
{
$mSpecParts = explode( ',', $test );
foreach( $mSpecParts as $i => $part )
{
$str = "";
foreach( $searches as $search )
{
if( strpos( $part, $search) !== false )
{
$str = explode( $search, $part );
$str = $str[count($str)-1];
}
}
if( strlen( $str ) )
{
if( $value1 )
{
echo " Setting value2 to " . trim( $str ) . "\n";
$value2 = trim( $str );
}else{
echo " Setting value1 to " . trim( $str ) . "\n";
$value1 = trim( $str );
}
}
}
if( $value2 > $value1 )
{
$tmp = $value2;
$value2 = $value1;
$value1 = $tmp;
}
echo "\n value1 = $value1 & value2 = $value2";
}
- Output for 5.6.38, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
- Setting value1 to 25
Setting value2 to 35
value1 = 35 & value2 = 25 Setting value2 to 100
Setting value2 to 81
value1 = 81 & value2 = 35 Setting value2 to = 25
Setting value2 to = 35
value1 = = 35 & value2 = 81 Setting value2 to 25
Setting value2 to 35
value1 = = 35 & value2 = 35 Setting value2 to 25
Setting value2 to 35
value1 = = 35 & value2 = 35 Setting value2 to : 25
Setting value2 to : 35
value1 = = 35 & value2 = : 35
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Setting value1 to 25
Setting value2 to 35
value1 = 35 & value2 = 25 Setting value2 to 100
Setting value2 to 81
value1 = 81 & value2 = 35 Setting value2 to = 25
Setting value2 to = 35
value1 = = 35 & value2 = 81 Setting value2 to 25
Setting value2 to 35
value1 = = 35 & value2 = 35 Setting value2 to 25
Setting value2 to 35
value1 = = 35 & value2 = 35 Setting value2 to : 25
Setting value2 to : 35
value1 = = 35 & value2 = : 35
preferences:
144.32 ms | 403 KiB | 179 Q