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 8502791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:35:01+00:00 2026-06-11T01:35:01+00:00

I am trying create an array of variables in different types. My aim is

  • 0

I am trying create an array of variables in different
types.

My aim is to create a .csv file to use with Canada Post Electronic Shipping Tools.
(code to create .csv file is not included here)

I am using Canada Post’s Electronic Shipping Guide’s
2.2.4 Import Orders Items Records – Layout Type 5 document.

I have to create 52 elements array and keep some “integer”, “boolean”,”currency”, “long”, and “place holder values” in the array.

My issues are.

  1. How can I define long values?
  2. What should I do to fill “place holder” values.

This is an example of place holder requirement.

Field NO:32, Field:US Postal Box indicator Type: Placeholder Length: 1 Format Notes: “1” indicates that the field is blank.

Below is the code I use to create an array

<?php
$record_count_array = array();
//Create an integer value
$integer = 00;
$integer =  (integer)$integer ;
//Create a boolean value
$boolean = 1;
$boolean =  (boolean )$boolean  ;
//Fake long value -  Please lset me know your suggestions
$long    = 100000;
$string  = "string_value";
//Create a currency value
$currency = 10.00;
$currency = money_format('%i', $currency);
//Fake spaceholder value -  Please lset me know your suggestions
$placeholder = 2;
//Create a 52 item array
for($count = 0; $count< 52 ; $count++)
{
if($count == 0 || $count == 23 || $count == 47){
$record_count_array[] = $integer;
}
elseif($count == 18 || $count == 24 || $count == 25 || $count == 26) {
$record_count_array[] = $long;
}elseif($count == 27 || $count == 28 || $count == 29 || $count == 32
|| $count == 33 || $count == 34 || $count == 35 || $count == 36
|| $count == 37 || $count == 38 || $count == 39 || $count == 40
|| $count == 41 || $count == 44 || $count == 48 || $count == 49
|| $count == 50) {
$record_count_array[] = $boolean;
}elseif($count == 31 || $count == 42 || $count == 43) {
$record_count_array[] = $placeholder;
}elseif($count == 46) {
$record_count_array[] = $currency;
}
else{
$record_count_array[] = $string;
}
}
var_dump($record_count_array)."<br />";
?>

And this is the output I get (using var_dump())

array(52) 
{[0]=> int(0) [1]=> string(12) "string_value" 
[2]=> string(12) "string_value" [3]=> string(12) "string_value" 
[4]=> string(12) "string_value" [5]=> string(12) "string_value" 
[6]=> string(12) "string_value" [7]=> string(12) "string_value" 
[8]=> string(12) "string_value" [9]=> string(12) "string_value" 
[10]=> string(12) "string_value" [11]=> string(12) "string_value" 
[12]=> string(12) "string_value" [13]=> string(12) "string_value" 
[14]=> string(12) "string_value" [15]=> string(12) "string_value" 
[16]=> string(12) "string_value" [17]=> string(12) "string_value" 
[18]=> int(100000) [19]=> string(12) "string_value" 
[20]=> string(12) "string_value" [21]=> string(12) "string_value" 
[22]=> string(12) "string_value" [23]=> int(0) [24]=> int(100000) 
[25]=> int(100000) [26]=> int(100000) [27]=> bool(true) 
[28]=> bool(true) [29]=> bool(true) [30]=> string(12) "string_value" 
[31]=> int(2) [32]=> bool(true) [33]=> bool(true) 
[34]=> bool(true) [35]=> bool(true) [36]=> bool(true) 
[37]=> bool(true) [38]=> bool(true) [39]=> bool(true) 
[40]=> bool(true) [41]=> bool(true) [42]=> int(2) 
[43]=> int(2) [44]=> bool(true) 
[45]=> string(12) "string_value" [46]=> string(5) "10.00" 
[47]=> int(0) [48]=> bool(true) 
[49]=> bool(true) [50]=> bool(true) 
[51]=> string(12) "string_value" } 

Can somebody guide me to

  1. Format long variables correctly.
  2. Understand what is “place holder” variable do and how to format them?

Thank you very much

  • 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-11T01:35:03+00:00Added an answer on June 11, 2026 at 1:35 am

    1 – You can treat the long as integer, as PHP doesn’t have the long type (AFAIK)
    2 – For the placeholder, I don’t know if I understood correctly the problem but I’d suggest you to take a look on sprintf (https://www.php.net/sprintf) to format the string.

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

Sidebar

Related Questions

I am trying to create a php array where I can store 2 variables
I'm trying to use a string array as a holder of different variable names
I'm trying to create an array that maps strings to variables. It seems that
Im trying to create an array of tm* structs, and then return them at
I am trying to create an array of product SKU's which I can then
I'm trying to create an array from selected table rows so I can push
I am trying to create an array of class objects taking an integer argument.
I'm trying to create an array to display the last 5 products a customer
I am trying to create an array or list that could handle in theory,
I'm trying to create an array of strings that can be randomized and limited

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.