PHP-তে স্ট্রিংয়ের প্রথম ক্যারেক্টার সরানোর কোড নিচে দেওয়া হলো:
উদাহরণ
<?php $str = "Test"; echo "Before removing the first character = ".$str; $res = substr($str, 1); echo "\nAfter removing the first character = ".$res; ?>
আউটপুট
এটি নিচের আউটপুটটি দেবে:
Before removing the first character = Test After removing the first character = est
উদাহরণ
আরেকটি উদাহরণ দেখা যাক:
<?php $str = "Demo"; echo "Before removing the first character = ".$str; $res = ltrim($str, 'D'); echo "\nAfter removing the first character = ".$res; ?>
আউটপুট
এটি নিচের আউটপুটটি দেবে:
Before removing the first character = Demo After removing the first character = emo