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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:16:59+00:00 2026-05-16T11:16:59+00:00

I have this python script b_string = pack(‘>hqh2sh13sh5sh3sBiiihiiiiii’, 21, 0, len(country), country, len(device), device,

  • 0

I have this python script

b_string = pack('>hqh2sh13sh5sh3sBiiihiiiiii',
                21, 0,
                len(country), country,
                len(device), device,
                len('1.3.1'), "1.3.1",
                len('Web'), "Web",
                27, 0, 0,
                3, 0, cid, lac,
                0, 0, 0, 0)

and I want to convert it to php, this is what I came with so far

$body= pack('nln2c*n13c*n5c*n3c*Ciiiniiiiii',
                    21, 0,
                    strlen($this->_mccToCountry[$this->_mcc]), $this->_mccToCountry[$this->_mcc],
                    strlen($this->_device), $this->_device,
                    strlen('1.3.1'), "1.3.1",
                    strlen('Web'), "Web",
                    27, 0, 0,
                    3, 0, $this->_cellId, $this->_lac,
                    0, 0, 0, 0);

The variables are same as those in python script, but i got this error

PHP Warning: pack(): Type n: too few arguments in …/application/extensions/Zend-extensions/NMS/Bts.php:150

The help will be very appreciated.

  • 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-16T11:16:59+00:00Added an answer on May 16, 2026 at 11:16 am

    Your parameter string is all screwed up. You indicate in places that you are going to pass 2, 5, 3 and 13 shorts, but only provide one each time. You indicate that you are going to provide a series of characters but then you provide a NUL terminated string. You indicate that you will be providing an unsigned char but don’t provide one. Try this format string instead:

    'nlna*na*na*na*i3ni6'
    

    Another option is to use serialize and deserialize instead. Not sure if it matters to you that the data is packed into bytes or serialized into strings.

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

Sidebar

Related Questions

I have some questions about the performance of this simple python script: import sys,
I have a python script the runs this code: strpath = sudo svnadmin create
I have a Python script that is running a few ls commands. This script
I have problem with python multithreaded Queues. I have this script, where producer take
Hello Guys! I started learning python GUI development. Let's say I have this script:
i have written this python program. whenever i run the script using parameters like
I am wondering if I could have some fresh eyes on this python script.
I have this program in Python which should save text files to a folder
I have this code in Python inputted = input(Enter in something: ) print(Input is
I have this function in Python: def Rotate_Vector(vector, axis, direction): where vector is a

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.