π Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (178K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube
1. Which function is used to find the length of a string in PHP?
Answer:
Explanation:
The strlen() function is used to find the length of a string in PHP.
2. How do you concatenate two strings in PHP?
Answer:
Explanation:
The . operator is used for string concatenation in PHP.
3. Which of the following is the correct way to declare a string in PHP?
Answer:
Explanation:
In PHP, strings can be declared with either single quotes or double quotes.
4. What is the output of the following PHP code? $str = "Hello"; echo $str[1];
Answer:
Explanation:
Strings in PHP are zero-indexed. $str[1] refers to the second character, which is 'e'.
5. How do you replace 'world' with 'PHP' in the string 'Hello world' using PHP?
Answer:
Explanation:
The str_replace() function is used for string replacement in PHP.
6. Which function is used to reverse a string in PHP?
Answer:
Explanation:
The strrev() function is used to reverse a string in PHP.
7. How can you convert a string to lowercase in PHP?
Answer:
Explanation:
The strtolower() function is used to convert a string to lowercase in PHP.
8. What does the strpos() function do in PHP?
Answer:
Explanation:
The strpos() function is used to find the position of the first occurrence of a specified substring in a string.
9. Which of the following is not a valid way to declare a multiline string in PHP?
Answer:
Explanation:
Multiline strings can be declared using double quotes, heredoc, or nowdoc syntax, but not with single quotes.
10. What is the output of the following code? $str = "Hello"; echo strtoupper($str);
Answer:
Explanation:
strtoupper() converts all characters in a string to uppercase.
11. How do you access the last character of a string in PHP?
Answer:
Explanation:
$str[strlen($str) - 1] will return the last character of the string.
12. Which function is used to split a string into an array in PHP?
Answer:
Explanation:
The explode() function is used to split a string by a delimiter into an array.
13. How do you trim whitespace from the beginning and end of a string in PHP?
Answer:
Explanation:
The trim() function removes whitespace from the beginning and end of a string.
14. What does the substr() function do in PHP?
Answer:
Explanation:
The substr() function is used to return a part of a string.
15. Which of the following characters is used to escape special characters in a string in PHP?
Answer:
Explanation:
The backslash (\) is used to escape special characters in a string in PHP.
My Top and Bestseller Udemy Courses. The sale is going on with a 70 - 80% discount. The discount coupon has been added to each course below:
Build REST APIs with Spring Boot 4, Spring Security 7, and JWT
[NEW] Learn Apache Maven with IntelliJ IDEA and Java 25
ChatGPT + Generative AI + Prompt Engineering for Beginners
Spring 7 and Spring Boot 4 for Beginners (Includes 8 Projects)
Available in Udemy for Business
Building Real-Time REST APIs with Spring Boot - Blog App
Available in Udemy for Business
Building Microservices with Spring Boot and Spring Cloud
Available in Udemy for Business
Java Full-Stack Developer Course with Spring Boot and React JS
Available in Udemy for Business
Build 5 Spring Boot Projects with Java: Line-by-Line Coding
Testing Spring Boot Application with JUnit and Mockito
Available in Udemy for Business
Spring Boot Thymeleaf Real-Time Web Application - Blog App
Available in Udemy for Business
Master Spring Data JPA with Hibernate
Available in Udemy for Business
Spring Boot + Apache Kafka Course - The Practical Guide
Available in Udemy for Business
Comments
Post a Comment
Leave Comment