Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

yaml_emit(3) [php man page]

YAML_EMIT(3)								 1							      YAML_EMIT(3)

yaml_emit - Returns the YAML representation of a value

SYNOPSIS
string yaml_emit (mixed $data, [int $encoding = YAML_ANY_ENCODING], [int $linebreak = YAML_ANY_BREAK], [array $callbacks]) DESCRIPTION
Generate a YAML representation of the provided $data. PARAMETERS
o $data - The $data being encoded. Can be any type except a resource. o $encoding - Output character encoding chosen from YAML_ANY_ENCODING, YAML_UTF8_ENCODING, YAML_UTF16LE_ENCODING, YAML_UTF16BE_ENCODING. o $linebreak - Output linebreak style chosen from YAML_ANY_BREAK, YAML_CR_BREAK, YAML_LN_BREAK, YAML_CRLN_BREAK. o $callbacks - Content handlers for emitting YAML nodes. Associative array of classname => callable mappings. See emit callbacks for more details. RETURN VALUES
Returns a YAML encoded string on success. CHANGELOG
+--------+--------------------------------------+ |Version | | | | | | | Description | | | | +--------+--------------------------------------+ | 1.1.0 | | | | | | | The $callbacks parameter was added. | | | | +--------+--------------------------------------+ EXAMPLES
Example #1 yaml_emit(3) example <?php $addr = array( "given" => "Chris", "family"=> "Dumars", "address"=> array( "lines"=> "458 Walkman Dr. Suite #292", "city"=> "Royal Oak", "state"=> "MI", "postal"=> 48046, ), ); $invoice = array ( "invoice"=> 34843, "date"=> 980208000, "bill-to"=> $addr, "ship-to"=> $addr, "product"=> array( array( "sku"=> "BL394D", "quantity"=> 4, "description"=> "Basketball", "price"=> 450, ), array( "sku"=> "BL4438H", "quantity"=> 1, "description"=> "Super Hoop", "price"=> 2392, ), ), "tax"=> 251.42, "total"=> 4443.52, "comments"=> "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.", ); var_dump(yaml_emit($invoice)); ?> The above example will output something similar to: string(628) "--- invoice: 34843 date: 980208000 bill-to: given: Chris family: Dumars address: lines: |- 458 Walkman Dr. Suite #292 city: Royal Oak state: MI postal: 48046 ship-to: given: Chris family: Dumars address: lines: |- 458 Walkman Dr. Suite #292 city: Royal Oak state: MI postal: 48046 product: - sku: BL394D quantity: 4 description: Basketball price: 450 - sku: BL4438H quantity: 1 description: Super Hoop price: 2392 tax: 251.420000 total: 4443.520000 comments: Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338. " SEE ALSO
yaml_emit_file(3), yaml_parse(3). PHP Documentation Group YAML_EMIT(3)

Check Out this Related Man Page

IMAP_MAIL_COMPOSE(3)							 1						      IMAP_MAIL_COMPOSE(3)

imap_mail_compose - Create a MIME message based on given envelope and body sections

SYNOPSIS
string imap_mail_compose (array $envelope, array $body) DESCRIPTION
Create a MIME message based on the given $envelope and $body sections. PARAMETERS
o $envelope - An associative array of headers fields. Valid keys are: "remail", "return_path", "date", "from", "reply_to", "in_reply_to", "subject", "to", "cc", "bcc", "message_id" and "custom_headers" (which contains associative array of other headers). o $body - An indexed array of bodies A body is an associative array which can consist of the following keys: "type", "encoding", "charset", "type.parameters", "subtype", "id", "description", "disposition.type", "disposition", "contents.data", "lines", "bytes" and "md5". RETURN VALUES
Returns the MIME message. EXAMPLES
Example #1 imap_mail_compose(3) example <?php $envelope["from"]= "joe@example.com"; $envelope["to"] = "foo@example.com"; $envelope["cc"] = "bar@example.com"; $part1["type"] = TYPEMULTIPART; $part1["subtype"] = "mixed"; $filename = "/tmp/imap.c.gz"; $fp = fopen($filename, "r"); $contents = fread($fp, filesize($filename)); fclose($fp); $part2["type"] = TYPEAPPLICATION; $part2["encoding"] = ENCBINARY; $part2["subtype"] = "octet-stream"; $part2["description"] = basename($filename); $part2["contents.data"] = $contents; $part3["type"] = TYPETEXT; $part3["subtype"] = "plain"; $part3["description"] = "description3"; $part3["contents.data"] = "contents.data3 "; $body[1] = $part1; $body[2] = $part2; $body[3] = $part3; echo nl2br(imap_mail_compose($envelope, $body)); ?> PHP Documentation Group IMAP_MAIL_COMPOSE(3)
Man Page