// Perform operation on the server $sum = $client->calc($operation); print_r($sum); // Next, let's create the Matrix: // | 1 2 3 | // | 4 5 6 | // | 7 8 9 | $m1 = new Matrix(); $m1->rows = 3; $m1->cols = 3; $m1->data = array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9)); // Let's calculate its transpose, much to difficult in PHP! $m2 = $client->transpose($m1); echo "The Trasnpose of m1 is :\r\n"; print_r($m2); // Next, Let's now multiply m with its transpose, again too hard for PHP $m3 = $client->mult($m1, $m2); echo "The product of m1 and m2 is :\r\n"; print_r($m3); // And finally, we close the thrift connection $transport->close(); } catch (ArithmaticException $ae) { // performed an illegal operation, like 10/0 echo "ArithmatixException: " . $ae->msg . "\r\n"; } catch (MatrixException $mx) { // performed an illegal matrix operation echo "MatrixException: " . $mx->msg . "\r\n"; } catch (TException $tx) { // a general thrift exception, like no such server echo "ThriftException: " . $tx->getMessage() . "\r\n"; }