• similar to HEREDOC, but no parsing is conducted
• same <<< identifier, but the identifier must be enclosed in single quotes
• Do not indent ending identifier or add any chars
<?php $string = <<<'DEMO' PHP Code DEMO; echo $string; ?>
• similar to HEREDOC, but no parsing is conducted
• same <<< identifier, but the identifier must be enclosed in single quotes
• Do not indent ending identifier or add any chars
<?php $string = <<<'DEMO' PHP Code DEMO; echo $string; ?>
<script type=”text/javascript”>
if(window.location.href.indexOf(“https:”) > -1) {
alert(“its a secure URL”);
}
</script>
<script type=”text/javascript”>
var string=”PHPCode”;
string=string.replace(“Code”,”Codez”);
alert(string);
</script>
It wraps a string into new lines when it reaches a specific length.
Example
<?php
echo wordwrap(“It wraps a string into new lines when it reaches a specific length”,5);
?>
Output
It wraps a string into new lines when it reaches a specific length
It return a formatted string
Example
<?php
echo vsprintf(“%s %s”,array(“php”,”code”));
?>
Output
php code
It output a formatted string
Example
<?php
vprintf(“%s %s”,array(“php”,”code”));
?>
Output
php code
It writes a formatted string to a specified output stream
Example
<?php
$file = fopen(“test.txt”,”w”);
echo vfprintf($file,”%s%s”,array(“PHP”,”Code”));
?>
Output
7
It converts the first character of each word in a string to uppercase
Example
<?php
echo ucwords(“php code”);
?>
Output
Php Code
It make a string’s first character uppercase
Example
<?php
echo ucfirst(“phpcode”);
?>
Output
Phpcode
It strips whitespace from the beginning and end of a string
Example
<?php
echo trim(” php code “);
?>
Output
php code