Module 6 Blog: Introduction to PHP Functions and Strings

For this module, I explored PHP and learned how functions and strings can work together to generate dynamic content on a website. Unlike HTML, which primarily structures a webpage, PHP allows developers to process information on the server before displaying it to visitors.

For my assignment, I created a custom function called welcomeMessage() that accepts a name as a parameter and returns a personalized greeting. I also experimented with PHP string functions, including strlen(), strtoupper(), and str_word_count(). These functions allowed me to determine the length of a sentence, convert its text to uppercase, and count the number of words.

Functions and strings are connected because functions can accept strings as arguments, manipulate them, and return new results. This makes code more reusable and helps reduce repetition when developing websites.

One important aspect I learned was that PHP files must be saved using the .php extension and uploaded to a server that supports PHP. Overall, this assignment helped me better understand how server-side programming can expand the functionality of my existing website.

References

PHP Documentation. (n.d.). Strings. https://www.php.net/manual/en/book.strings.php

PHP Documentation. (n.d.). User-defined functions. https://www.php.net/manual/en/functions.user-defined.php

Leave a comment