snarkyazoid
snarkyazoid

Reputation: 455

PHP: Read character after position

I have:

<?php
$word = "hello";
$emaillen = strlen($word);
$lnpos = $emaillen + 1;
?>

I want to read the first character after $lnpos. The character after $lnpos is 1.
The text I am reading from is:

hello.1;

Thank you for your kind attention!

Upvotes: 0

Views: 475

Answers (1)

wezzy
wezzy

Reputation: 5935

you can access characters like arrays so if $lnpos is your position and you want to access the character at $lnpos + 1 just do:

$yourstring[$lnpos + 1];

Remeber to check that $lnpos + 1 < strlen($yourstring)

Hope this helps

Upvotes: 1

Related Questions