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

  • SEARCH
  • Home
  • 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 6532505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:00:41+00:00 2026-05-25T10:00:41+00:00

I need to create a bunch of feeds in a fixed width format, they’re

  • 0

I need to create a bunch of feeds in a fixed width format, they’re all relatively the same in layout, but they can all have different formats.

For example:

Field 1 can be 30 bytes wide, left justified and padded with 0s
Field 2 can be 20 bytes wide, right justified padded with spaces

I’d like to store parameters for php’s str_pad in the DB, but don’t know the best way to store the pad_type parameter, since it’s a constant, I can’t read it back like:

$field = str_pad($input, $width, $pad_string, $pad_type)

I suppose I could wrap an eval() around $pad_type, but that seems sketchy.

Is there a better way to do this?

I’m stuck with, PHP 5.0, MySQL 4

  • 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-05-25T10:00:42+00:00Added an answer on May 25, 2026 at 10:00 am

    Use constant():

    $value = constant('NAME_OF_THE_CONSTANT_AS_STORED_IN_DB');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, I'm doing a bunch of RIA/AJAX stuff and need to create a pretty,
I need to create a 2D int array of size 800x800. But doing so
I have an XSD file including some patterns and need to create a bunch
For some of my winforms applications I need to create a whole bunch of
I need help creating a method that allows me to create a bunch of
I am evaluating ServiceStack at the moment. I am in need to create bunch
I need to create a bunch of timer as local variable to do something
I need to create some sort of a state for a bunch of elements
I need to create a a bunch a views on the fly. I was
I need to create an application that generates a bunch of templates for Office

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.