Question : PHP print — Output a string
Answered by : samer-saeid
<?php
print "print does not require parentheses.";
// No newline or space is added; the below outputs "helloworld" all on one line
print "hello";
print "world";
print "This string spans
multiple lines. The newlines will be
output as well";
print "This string spans\nmultiple lines. The newlines will be\noutput as well.";
// The argument can be any expression which produces a string
$foo = "example";
print "foo is $foo"; // foo is example
$fruits = ["lemon", "orange", "banana"];
print implode(" and ", $fruits); // lemon and orange and banana
// Non-string expressions are coerced to string, even if declare(strict_types=1) is used
print 6 * 7; // 42
// Because print has a return value, it can be used in expressions
// The following outputs "hello world"
if ( print "hello" ) {
echo " world";
}
// The following outputs "true"
( 1 === 1 ) ? print 'true' : print 'false';
?>
Source : | Last Update : Sat, 21 May 22
Question : how to print in php
Answered by : mutasim-almualimi
<?php echo 'hello world';
?>
Source : | Last Update : Sat, 10 Sep 22
Question : php print object
Answered by : modern-macaw-cob9p0xp4sro
$class_methods = get_class_methods('myclass');
// or
$class_methods = get_class_methods(new myclass());
foreach ($class_methods as $method_name)
{ echo "$method_name<br/>";
}
Source : https://stackoverflow.com/questions/3034530/php-print-all-properties-of-an-object | Last Update : Wed, 27 May 20
Question : how to print something in php
Answered by : iamatp-on-scratch
<?php
$text = "random text";
$number1 = 32;
echo $text;
echo $number1;
echo "Normal text should be in double quotes <br>";
echo ("You can use parenthesis as well, as an advice you shouldn't because
it takes more space, but after all, it's your choice <br>");
echo "You", "can", "use many parameters", "like shown right here", "you can
use html tags if you're using it in html as well like shown right below <br>";
echo "<h4>. $number1 .</h4>";
echo $number1 + 23.12;
?>
Source : | Last Update : Fri, 17 Jun 22