Functions in PHP: Difference between revisions

From Free Knowledge Base- The DUCK Project
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
Line 10: Line 10:


{{:Sparse Entry}}
{{:Sparse Entry}}
=== ordinal numbers function ===
In English, when referring to the day of the month, cardinal numbers (1, 2, 3, etc.) are converted to [[ordinal numbers]] by adding a suffix to indicate their position in the sequence. The suffixes used are -st, -nd, -rd, and -th
PHP has a Added getOrdinalSuffix function to convert rentdueday (e.g., 1, 2, 3) to ordinal form (1st, 2nd, 3rd, 4th, etc.).
Example:
<nowiki><?php echo htmlspecialchars(getOrdinalSuffix($tablename['day'])); ?></nowiki>


[[Category:Computer Technology]]
[[Category:Computer Technology]]
[[Category:Programming]]
[[Category:Programming]]
[[Category:PHP]]
[[Category:PHP]]

Latest revision as of 13:13, 24 April 2025

Here's the format of a function:

 function plus() {
       ?><img src="./images/plus.gif" width=22 height=22 alt="+" border="0" align="top"> <?
 }

Here's how to call a function:

 plus();

 

Note: This page is notably incomplete. You can help. Please contribute by registering your email address and adding your knowledge to this page. The D.U.C.K. wiki was created to be a free informative place that allows an open exchange of accurate information.
Learn more...

ordinal numbers function

In English, when referring to the day of the month, cardinal numbers (1, 2, 3, etc.) are converted to ordinal numbers by adding a suffix to indicate their position in the sequence. The suffixes used are -st, -nd, -rd, and -th

PHP has a Added getOrdinalSuffix function to convert rentdueday (e.g., 1, 2, 3) to ordinal form (1st, 2nd, 3rd, 4th, etc.).

Example:

<?php echo htmlspecialchars(getOrdinalSuffix($tablename['day'])); ?>