CKTIS / PHP
Keyword print
Write a single expression as text and return the integer 1.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
print $value;Write a single expression as text and return the integer 1. This language construct can appear inside an expression. It takes a single operand. Concatenate pieces or use another output statement when multiple fragments are needed. The && operator binds tighter: print "A" && false prints nothing, while (print "A") && false prints A.
$result=print("AB"); echo ":",$result,":",get_debug_type($result);
echo "\n["; print "A" && false; echo "]["; (print "A") && false; echo "]";
AB:1:int
[][A]
Examples
<?php
$result=print("AB"); echo ":",$result,":",get_debug_type($result);
echo "\n["; print "A" && false; echo "]["; (print "A") && false; echo "]";
Result
AB:1:int [][A]