Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php class Point { public $x; public $y; public function __construct($x, $y) { $this->x = $x; $this->y = $y; } } class Segment { public $beginPoint; public $endPoint; public function __construct($beginPoint, $endPoint) { $this->beginPoint = $beginPoint; $this->endPoint = $endPoint; } } function reverse($point1, $point2) { $point1 = new Point(); $point1->x = $point2->x; $point1->y = $point2->y = $y; $newSegment = segment($point1, $point2); } $point1 = new Point(1, 10); $point2 = new Point(11, -3); $t = reverse($point1, $point2); print_r($t);
Copy Clear