Sometimes you want to alter the value of a node or an attribute in an xml document. You can read the XML file using PHP’s SimpleXML to assign new values to elements or attribute and save the changes back to the file.
<?php
$xml = simplexml_load_file(“data.xml”);
/* Aletr value of a node */
…
Tag Archives: string
XML file using PHP SimpleXML
Filed under SEO
Php Interview Questions and Answers – Part 8
Php Interview Questions and Answers – Part 8
1- Give the syntax of REVOKE commands?
The generic syntax for revoke is as following
REVOKE [rights] on [database] FROM [username@hostname]
Now rights can be:
a) ALL privileges
b) Combination of CREATE, DROP, SELECT, INSERT, UPDATE and DELETE etc.
We c…
Filed under PHP
Php Interview Questions and Answers – Part 3
1- What is the difference between CHAR and VARCHAR data types?
CHAR is a fixed length data type. CHAR(n) will take n characters of storage even if you enter less than n characters to that column. For example, “Hello!” will be stored as “Hello! ” in CHAR(10) column.
VARCHAR is a variable…
Filed under PHP
Wrapping Text in PHP
Sometimes we need to wrap text to exactly accommodate a certain width of text or allowing browsers to wrap text whenever required. You can use PHP’s wordwrap() function to wrap a string into new lines when it reaches a specific length. This function limits text display to a particular column…
Filed under PHP
Order Editor tep_add_base_ref AJAX ERROR FIX – osCommerce
Fatal error: Call to undefined function tep_add_base_ref() in /home/XXXX/public_html/XXXX/admin/edit_orders_ajax.php on line 1149
For those who have this problem:add below code to admin/include/function/general.php before closing tag ?>
function tep_add_base_ref($string) {
$i = 0;
…
Filed under PHP
Php Interview Questions and Answers – Part 2
1- Why doesn’t the following code print the newline properly? <?php $str = ‘Hello, there.nHow are you?nThanks for visiting techpreparation’; print $str; ?>
Because inside the single quotes the n character is not interpreted as newline, just as a sequence of two characters – and…
Filed under PHP
Parse JSON, XML and HTML – jQuery
In this post, find out jQuery code on how to parse JSON, parse XML and parse HTML. If you are still using custom code for parsing any of these and making your life more miserable then stop doing it. Why? If you are not aware then here is a news for you that jQuery has inbuilt utility methods for…
Filed under Uncategorized
Php Interview Questions and Answers – Part 1
1- What’s PHP ?
The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications.
2- What Is a Session?
A session is a logical object created by the…
Filed under PHP
Remove Repeated Words in String – PHP
Usually we do remove duplicate words from a string using array functions etc, But it’s very slow doing that way because of the size of the string. The fastest way to achieve the same result is PHP regex.
You can remove duplicate words using PHP regular expressions with preg_replace. Below is a…
Filed under PHP
PHP Interview Questions and Answers – Part 4
1- What is the difference between ereg_replace() and eregi_replace()?
eregi_replace() function is identical to ereg_replace() except that it ignores case distinction when matching alphabetic characters.
2- How do I find out the number of parameters passed into function9. ?
func_num_args()…
Leave a comment
Filed under PHP
Tagged as array, comment, DROP, ERRORS, JavaScript, PHP, string, TRUNCATE, URL