User Tools

Site Tools


uphp:functions:pack

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

uphp:functions:pack [2019/12/20 09:30]
admin
uphp:functions:pack [2021/09/13 05:57]
Line 1: Line 1:
-======pack====== 
  
-<badge>WMMEGA FW >= 2.1167</badge> 
- 
-<html>pack — Pack data into binary string</html> 
- 
-====Description==== 
- 
-<well size="sm"><html> 
-<span style="font-size:125%;color:green">string 
-<span style="color:black">pack ( 
-<span style="color:green">string 
-<span style="color:blue">$format<span style="color:black">, 
-<span style="color:green">mixed 
-<span style="color:blue">$value 
-<span style="color:black">) 
-</html></well> 
- 
-<html>Pack given arguments into a binary string according to format.</html> 
- 
-====Parameters==== 
- 
-<html><b><span style="color:blue">$format<span style="color:black"></b>:  <b><span style="color:green">String<span style="color:black"></b> containing one of the following items:</html> 
-^ Value  ^ Description                                      ^ 
-| l      | signed long (always 32 bit, machine byte order)  | 
-| L      | unsigned long (always 32 bit, machine byte order)  | 
-| f      | floating point(always 32 bit, machine byte order)  | 
-| c      | signed byte   | 
-| C      | unsigned byte | 
- 
-<html><b><span style="color:blue">$value<span style="color:black"></b>: Value is dependent on the function. 
- 
-====Return Values==== 
- 
-<html><b><span style="color:green">string<span style="color:black"></b></html>:  Binary string containing value 
- 
-====Example==== 
- 
-<code php> 
-<? 
-  v=-1234; 
-  $str=pack("l",$v); 
-  print("\r\nPacked signed long:\r\n"); 
-  for ($i=0;$i<4;$i++) { 
-    $c=charat($str,$i); 
-    printf("%02X ",$c); 
-  } 
- 
- 
-  print("\r\nUn packed signed long:\r\n"); 
-  $v=unpack("l",&$str); 
- 
-  print($v); 
-?> 
-</code> 
- 
-====See Also==== 
- 
-[[unpack()]] - Unpack a binary string 
uphp/functions/pack.txt · Last modified: 2021/09/13 05:57 (external edit)