Tools, FAQ, Tutorials:
Accessing a Specific Character in String in PHP
How To Access a Specific Character in a String?
✍: FYIcenter.com
Any character in a string can be accessed by a special string element expression:
Here is a PHP script example:
<?php $string = 'It\'s Friday!'; echo "The first character is $string{0}\n"; echo "The first character is {$string{0}}\n"; ?>
This script will print:
The first character is It's Friday!{0} The first character is I
⇒ Assigning a New Character in a String in PHP
⇐ Including Array Elements in Double-Quoted Strings in PHP
2016-10-13, 1481👍, 0💬
Popular Posts:
How to add request URL Template Parameters to my Azure API operation to make it more user friendly? ...
How to run CMD Commands in Dockerfile to change Windows Docker images? When building a new Windows i...
How To Control Padding Spaces within a Table Cell? Cell padding spaces are spaces between cell inner...
How to use the Atom Online Validator at w3.org? w3.org feed validation service is provided at http:/...
How to install .NET Framework in Visual Studio Community 2017? I have the Visual Studio Installer in...