Change language

PHP DOMDocument createEntityReference () function

Syntax:
DOMEntityReference DOMDocument::createEntityReference (string $name)
Parameters:This function takes one parameter, $name,which contains the content of the entity reference. The entity reference does not contain leading & amp; and final; characters.Returns:This function returns a new DOMEntityReference object on success or FALSE on error.The following programs illustrate the DOMDocument::createEntityReference ( ) in PHP:Program 1:  
// Create a new DOMDocument object $domDocument = new DOMDocument ( ’1.0’ , ’ iso-8859-1’ );  
// Use the createEntityReference() function to create
// new entity link node $domER = $domDocument -> createEntityReference ( ’nbsp’ );  
// Add element to document $domDocument -> appendChild ( $domER );  
// Save the XML document and display it echo $domDocument -> saveXML();  
?>
Exit:
 & amp; nbsp;
Program 2:  
// Create a new DOMDocument object $domDocument = new DOMDocument ( ’1.0’ , ’ iso-8859-1’ );  
// Use the createEntityReference() function to create
// new entity link node $domER1 = $domDocument -> createEntityReference ( ’amp’ ); $domER2 = $domDocument -> createEntityReference ( ’lt’ ); $domER3 = $domDocument -> createEntityReference ( ’gt’ ); $domER4 = $domDocument -> createEntityReference ( ’reg’ );  
// Add an element to the document $domDocument -> appendChild ( $domER1 ); $domDocument -> appendChild ( $domER2 ); $domDocument -> appendChild ( $domER3 ); $domDocument -> appendChild ( $domER4 );  
// Save the XML document and display it echo $domDocument -> saveXML();  
?>
Exit:
 & amp; amp; & amp; lt; & amp; gt; & amp; reg;
Link: https://www.php.net/ manual / en / domdocument.createentityreference.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method