Solution to 90 degree rotation of an NxN matrix
There's nothing really wrong with your class, but you could use array functions and foreach instead of for. 

Also, calling your class MatrixRotator is a bit weird. A class is used to combine and isolate several methods (= functions) and properties (= variables) into a handy package. A rotate() method would probably be part of a set of methods which can modify the matrix. And when that is the case it would make sense to store the matrix data in the matrix class. This would then require a set and get method.

This would result in something like this:

class Matrix
{
  private $data = [];

  public function __construct($data)
  // accepts an array with matrix data and stores it
  {
    $this-&gt;data = $data;
  }

  public function rotateClockwise()
  // rotate a matrix once clockwise
  {
    // check that the matrix contains data
    if (isset($this-&gt;data[0]) &amp;&amp; is_array($this-&gt;data[0]))
    {
      // perform the actual rotation
      $rotated = [];
      foreach (array_keys($this-&gt;data[0]) as $columnKey)
      {
        $rotated[] = array_reverse(array_column($this-&gt;data,$columnKey));
      }
      $this-&gt;data = $rotated;
    }
    // return this class so this method can be chained
    return $this;
  }

  public function getData()
  // returns the stored matrix
  {
    return $this-&gt;data;
  }
}


It can then be used like this:

// creation of a matrix
$matrix = new Matrix([[1,2,3],[4,5,6],[7,8,9]]);

// rotation and output
echo '&lt;pre&gt;';
print_r($matrix-&gt;rotateClockwise()-&gt;getData());
echo '&lt;/pre&gt;';


It is now easy to put other matrix manipulation methods into this class. For instance, by leaving out the array_reverse() from rotateClockwise() you will get a rotateAntiClockwise() method. So let's do that:

class Matrix
{
  private $data = [];

  public function __construct($data)
  {
    $this-&gt;data = $data;
    if (!$this-&gt;isValid()) trigger_error("Matrix data is invalid.");
  }

  public function isValid()
  {
    if (!is_array($this-&gt;data)) return FALSE;
    foreach ($this-&gt;data as $row)
    {
      if (!is_array($row)) return FALSE;
    }
    return TRUE;
  }

  public function reverseEachRow()
  {
    if ($this-&gt;isValid())
    {
      foreach ($this-&gt;data as $rowKey =&gt; $row)
      {
        $this-&gt;data[$rowKey] = array_reverse($row);
      }
    }
    return $this;
  }

  public function rotateAntiClockwise()
  {
    if ($this-&gt;isValid() &amp;&amp; isset($this-&gt;data[0]))
    {
      $rotated = [];
      foreach (array_keys($this-&gt;data[0]) as $columnKey)
      {
        $rotated[] = array_column($this-&gt;data,$columnKey);
      }
      $this-&gt;data = $rotated;
    }
    return $this;
  }

  public function rotateClockwise()
  {
    return $this-&gt;rotateAntiClockwise()
                -&gt;reverseEachRow();
  }

  public function getData()
  {
    return $this-&gt;isValid() ? $this-&gt;data : FALSE;
  }

}

$matrix = new Matrix([[1,2,3],[4,5,6],[7,8,9]]);

echo '&lt;pre&gt;';
print_r($matrix-&gt;rotateClockwise()-&gt;getData());
echo '&lt;/pre&gt;';


I left out all comments, to keep the code short, and I also centralized the validity check. This goes beyond your question, but shows you why you wouldn't want to call your class MatrixRotator, it is too specific.