3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); ini_set('display_errors', '1'); include "PhpSerial.php"; $serial = new PhpSerial; $serial->deviceSet("/dev/ttyUSB0"); $serial->confBaudRate(9600); $serial->confParity("none"); $serial->confCharacterLength(8); $serial->confStopBits(1); $serial->deviceOpen(); $status_req = ("W&"); $serial->sendMessage($status_req); $read = $serial->readPort(30); echo ($read); $ascii_read = array() //foreach($ascii_read as $reply) { print "<p>$reply</p>"; //$serial->deviceClose(); echo "I've sent a message! \n\r";
Output for 5.5.0 - 5.5.33, 5.6.0 - 5.6.19, 7.0.0 - 7.0.4, 7.4.33
Parse error: syntax error, unexpected 'print' (T_PRINT) in /in/ot1Ep on line 21
Process exited with code 255.

preferences:
172.8 ms | 1008 KiB | 7 Q