How to output a string with print() in PHP

8 Answers

0 votes
print("PHP World");


/*
run:
    
PHP World 
       
*/

 



answered Jul 15, 2016 by avibootz
0 votes
print "PHP Programming World";


/*
run:
    
PHP Programming World 
       
*/

 



answered Jul 15, 2016 by avibootz
0 votes
print "PHP 
       Programming 
       World
       print()";


/*
run:
    
PHP Programming World print() 
       
*/

 



answered Jul 15, 2016 by avibootz
0 votes
print "\"PHP\" include 5,000 functions";


/*
run:
    
"PHP" include 5,000 functions 
       
*/

 



answered Jul 15, 2016 by avibootz
0 votes
$s = "PHP";

print "$s include 5,100 functions<br />";
print '$s include 5,100 functions';



/*
run:
    
PHP include 5,100 functions
$s include 5,100 functions 
       
*/

 



answered Jul 15, 2016 by avibootz
edited Jul 15, 2016 by avibootz
0 votes
$arr = array("value" => "PHP");

print "C, {$arr['value']}, Java"; 


/*
run:
    
C, PHP, Java 
       
*/

 



answered Jul 15, 2016 by avibootz
0 votes
$s = "PHP";

print $s;



/*
run:
    
PHP  
       
*/

 



answered Jul 15, 2016 by avibootz
0 votes
$str = "PHP";

print <<<END
$str is a server-side scripting language 
designed for web development but also used as a 
general-purpose programming language.
END;



/*
run:
    
PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.  
       
*/

 



answered Jul 15, 2016 by avibootz

Related questions

1 answer 257 views
2 answers 326 views
3 answers 448 views
1 answer 365 views
1 answer 295 views
1 answer 326 views
...