PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/php/value/runme.php

#
PHP | 43 lines | 33 code | 10 blank | 0 comment | 0 complexity | 51dad22be79272e667525d5ea492c0b5 MD5 | raw file
 1<?php
 2
 3	require "example.php";
 4
 5
 6	$v = new_vector();
 7        vector_x_set($v,1.0);
 8        vector_y_set($v,2.0);
 9        vector_z_set($v,3.0);
10
11	$w = new_vector();
12        vector_x_set($w,10.0);
13        vector_y_set($w,11.0);
14        vector_z_set($w,12.0);
15
16	echo "I just created the following vector\n";
17	vector_print($v);
18	vector_print($w);
19
20	echo "\nNow I'm going to compute the dot product\n";
21
22	$d = dot_product($v, $w);
23
24	echo "dot product = $d (should be 68)\n";
25
26	echo "\nNow I'm going to add the vectors together\n";
27
28        $r = new_vector();
29	vector_add($v, $w, $r);
30
31	vector_print($r);
32
33	echo "The value should be (11,13,15)\n";
34
35	echo "\nNow I'm going to clean up the return result\n";
36
37#	free($r);
38
39	echo "Good\n";
40
41?>
42
43