Sorry if this is a real NEWB question. I searched the php.net site and this board and i can't find any solution to concatenate and integer.

example
$EventID = 32; // unique index of SQL table "Event"
$ClassID = 12; // unique index of SQL table "Class"
$EventClassID = $EventID . $ClassID; // i want this to be the unique Index of the relational table.

One event can have many different classes and one class can be assigned to many events. So I'm trying concatenate the numbers so that it keeps them unique yet intuitive.

any suggestions would be great!! thanks in advance!

Josh

    You'd want each part to be of constant length, of course, so you could do it like this (making use of PHP's implied typecasting):

    $str_1 = str_pad($EventID, 2, '0', STR_PAD_LEFT);
    $str_2 = str_pad($ClassID, 2, '0', STR_PAD_LEFT);
    $EventClassID = $str_1 . $str_2;
      Write a Reply...