[ create a new paste ] login | about

Link: http://codepad.org/jYGvuJxx    [ raw code | output | fork ]

PHP, pasted on Dec 13:
<?php

$matches = array(
    'DS' . 185,
    'MT' . 333,
    'HK' . 51,
    'main' . 1166,
    'WT' . 97
);

print_r($matches);

$game = 'DS';
$eventId = '185';

if (in_array($game.$eventId, $matches)) {
    echo "You found a match: $game.$eventId\n";
} else {
    echo "No match on: $game.$eventId\n";
}

$game = 'MT';
$eventId = '185';

if (in_array($game.$eventId, $matches)) {
    echo "You found a match: $game.$eventId\n";
} else {
    echo "No match on: $game.$eventId\n";
}

$game = 'main';
$eventId = '1166';

if (in_array($game.$eventId, $matches)) {
    echo "You found a match: $game.$eventId\n";
} else {
    echo "No match on: $game.$eventId\n";
}


?>


Output:
1
2
3
4
5
6
7
8
9
10
11
Array
(
    [0] => DS185
    [1] => MT333
    [2] => HK51
    [3] => main1166
    [4] => WT97
)
You found a match: DS.185
No match on: MT.185
You found a match: main.1166


Create a new paste based on this one


Comments: