Functions in PHP: Difference between revisions
Jump to navigation
Jump to search
New page: 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: pl... |
mNo edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 9: | Line 9: | ||
plus(); | plus(); | ||
{{: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();
![]() 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'])); ?>