So, if your js is inline, you can use php inside the script tag, see how:
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Untitled</title>
    <link rel="stylesheet" href="css/style.css">
    <link rel="author" href="humans.txt">
</head>
<body>
        <?php
        $cod = 23;
        ?>
        <select name="select" class="select2<?= $cod?>" id="item1">
            <option value="01">01</option>
        </select>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
        <script type="text/javascript">
            $('.selects2<?= $cod ?>').select2();
        </script>
</body>
</html>
Now, in case your js is inside an external file, you can create a variable in the window and recover it in your file thus:
HTML:
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Untitled</title>
    <link rel="stylesheet" href="css/style.css">
    <link rel="author" href="humans.txt">
</head>
<body>
        <?php
        $cod = 23;
        ?>
        <select name="select" class="select2<?= $cod?>" id="item1">
            <option value="01">01</option>
        </select>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
        <script type="text/javascript">
            window.classeSelect = ".select2<?= $cod ?>";
        </script>
        <script src="script.js"></script>
</body>
</html>
JS: 
$(window.classeSelect).select2();
							
							
						 
At what point do you want to take this class? What would be the purpose?
– Yure Pereira
The purpose would be to run the plugin Select2, in case I am running using the class that varies according to the $line [Cod].
– Wel