Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9013149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:11:16+00:00 2026-06-16T03:11:16+00:00

I noticed that PHP’s internal functions never use strings for pre-defined or limited values,

  • 0

I noticed that PHP’s internal functions never use strings for pre-defined or limited values, only constants.

For example:

pad_type:

Optional argument pad_type can be STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH. If pad_type is not specified it is assumed to be STR_PAD_RIGHT.

What’s the reason for not using a string as parameter here?

str_pad($test, 10, 0, 'left') seems a lot simpler than str_pad( $test, 10, 0, STR_PAD_LEFT)

(This is more of a meta question. I hope it’s OK to ask here.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:11:18+00:00Added an answer on June 16, 2026 at 3:11 am

    It is easier to make mistakes when typing a string. Using an undefined constant will throw a warning. It’s not just a PHP thing. Regular API functions (i.e. of an OS) usually use numeric constants as well for parameters like this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that PHP seems to return only values of checked checkboxes. I would
I noticed that some PHP frameworks use exclusively lowercase true / false and others
I have noticed that many websites use urls that end in website.com/index.php?var=value&var2=value2 and I
I've noticed that PHP's current() and key() array functions ( like other array-pointer functions
I've noticed that both openssl and mcrypt functions in PHP accept data to be
Just noticed that after login with user and password I'm never redirected to welcome.php
Possible Duplicate: Are PHP short tags acceptable to use? So I noticed that you
Possible Duplicate: php false place in condition I have noticed that a lot of
After using PHP for a while now, I've noticed that not all built-in PHP
I am using PHP mail() to send daily notice emails. But I noticed that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.