Jump to content

lorenzo314737

New Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by lorenzo314737

  1. No. I am really bad at coding. My teacher didnt give us information. We have to figure it out ourslves. I only know the basics of php and thats NOT enough for this puzzle game. I told my teacher i dont understand several times. He gave me this code of another student, so i could learn how to code it, but i dont understand and he doesnt explain it to me. So thats why i asked for help. 

     

  2. <>

    So ive found this code on the internet, but i dont understand the code. Can someone please help me?

    <?php
    $numbers= "2323";
    $position = "RLRR"; 
    $x = 1;
    
    if (isset( $_GET['position'])){
      $position = $_GET['position'];
    }
    
    for ($y =0; $y < strlen ($position); $y++) {
    
      $href = $position;
      $check = $position;
      $color = "red";
    
      if ( $href [$y] === 'L' ) {
        $href [$y] = 'R';
      } else { 
        $href [$y] = 'L';
      }
    
      $right = substr ($check, 0, $y);
      $right = str_replace ("L", "", $right);
      $right = strlen ($right);
    
      $left = substr ($check, $y);
      $left = str_replace ("R", "", $left);
      $left = strlen ($left);
    
      if ( intval ($numbers [$y]) === $right+$left) {
        $color= "green";
      }
    
      if (($color ) === "green") {
        $x ++;
      }
    ?>
    
      <td class=<?php echo $color; ?> ><?php echo $numbers[$y];?></td>
      <td>
        <a href="?position=<?php echo $href;?>">
        <img class="<?php echo $position [$y];?>" src="Pijllinks.jpg"></a>
      </td>
    <?php
    } 
    if (intval ($x) === 6) {
      $b="green";
    } else 
      return 
    ?>


     

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.